public class CPDFDocument
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CPDFDocument.PDFDocumentError
Error types of the opening document
|
static class |
CPDFDocument.PDFDocumentImageMode
Options to specify how a view adjusts its content when its size changes.
|
static class |
CPDFDocument.PDFDocumentPermissions |
static class |
CPDFDocument.PDFDocumentSaveType
Document save type.
|
Constructor and Description |
---|
CPDFDocument()
Creates PDF document
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPage(CPDFPage page,
int pageNum)
Add page to document
|
boolean |
canSaveIncrementally()
Whether document can be saved incrementally.
|
boolean |
checkOwnerPassword(java.lang.String password) |
void |
close()
When the object is no longer in use, call this method to release resources.
|
CPDFPage |
copyPage(int pageNum)
Copy the page at page index
|
CPDFCompare |
createCompare(CPDFDocument compDoc) |
CPDFCompare |
createCompare(CPDFDocument baseDoc,
CPDFDocument compDoc) |
CPDFCompareDrawings |
createCompareDrawings(CPDFDocument compDoc) |
static CPDFDocument |
createDocument()
Creates a CPDFDocument object with new PDF.
|
CPDFWatermark |
createWatermark(CPDFWatermark.Type type)
createWatermark
|
boolean |
exchangePage(int firstIndex,
int secondIndex)
Exchanges one page with another.
|
boolean |
exportAnnotations(java.lang.String exportXPDFPath,
java.lang.String tmpCacheDirPath)
Exports annotations to XFDF document.
|
boolean |
flattenAllPages(CPDFPage.PDFFlattenOption flattenOption)
Flatten all pages.
|
java.lang.String |
getBuildTag()
Gets build tag string of document.
|
long |
getDocPtr() |
java.lang.String |
getFilePath()
document absolute path
|
CPDFInfo |
getInfo()
Gets document information, more:
CPDFInfo |
int |
getMajorVersion()
Gets major version string of document.
|
int |
getMinorVersion()
Gets minor version string of document.
|
int |
getPageCount()
Gets total count of document pages.
|
java.lang.String |
getPageLabel(int pageNum)
Gets the page label at the specified index.
|
RectF |
getPageSize(int pageNum)
Gets page size at the specified index.
|
java.lang.String |
getPassword()
Gets document password.
|
CPDFDocument.PDFDocumentPermissions |
getPermissions()
Gets permission status of document, more:
CPDFDocument.PDFDocumentPermissions . |
CPDFDocumentPermissionInfo |
getPermissionsInfo()
Gets permission information of document, more:
CPDFDocumentPermissionInfo |
int |
getReVersion()
Gets revision string of document.
|
CPDFWatermark |
getWatermark(int index)
getWatermark
|
int |
getWatermarkCount() |
boolean |
hasChanges()
Whether document is modified.
|
boolean |
hasRepaired()
Whether document is repaired.
|
boolean |
importAnnotations(java.lang.String importXPDFPath)
Import annotations from XFDF document.
|
boolean |
importAnnotations(java.lang.String importFilePath,
java.lang.String tmpCachePath)
Import annotations from XFDF document.
|
boolean |
importPages(CPDFDocument otherDocument,
int[] pages,
int insertPosition)
Import page(s) from another document at the specified index point and insert to
insertPosition . |
boolean |
importPages(CPDFDocument otherDocument,
int start,
int end,
int insertPosition)
Import page(s) from another document at the specified index point and insert to
insertPosition . |
int |
indexOfPage(CPDFPage page)
Gets the index number for the specified page.
|
CPDFPage |
insertBlankPage(int pageIndex,
float width,
float height)
Inserts a blank page at the specified index point.
|
CPDFPage |
insertPageWithImagePath(int pageNum,
float width,
float height,
java.lang.String imagePath,
CPDFDocument.PDFDocumentImageMode imageMode)
Inserts a blank page with image at the specified index point.
|
boolean |
isEncrypted()
Whether document is encrypted.
|
boolean |
isLocked()
Whether the document is locked.
|
boolean |
isValid()
Whether CPDFDocument object is valid, false means CPDFDocument object is released.
|
boolean |
movePage(int fromIndex,
int toIndex)
Moves page.
|
CPDFDocument.PDFDocumentError |
open(java.lang.String absolutePath)
Loads the document
|
CPDFDocument.PDFDocumentError |
open(java.lang.String absolutePath,
java.lang.String password)
Loads the encrypted document.
|
CPDFPage |
pageAtIndex(int pageNum)
Returns a pageNum object representing the page at index, more:
CPDFPage . |
void |
releaseAllPages()
When CPDFPage is no longer in use, release all resource of CPDFPage.
|
void |
releaseAllWatermarks() |
boolean |
removePages(int[] pageNums)
Remove page(s).
|
boolean |
save(CPDFDocument.PDFDocumentSaveType saveType)
The doucment has changes, sava file.
|
boolean |
save(java.lang.String absolutePath,
CPDFDocument.PDFDocumentSaveType saveType)
The doucment has changes, sava file.
|
boolean |
saveForceByNoincremental()
Mandatory saving, the principle is to use non-incremental saving as a document to copy the current document
|
void |
setDocPtr(long docPtr) |
boolean |
setInfo(CPDFInfo info)
Sets document information, more:
CPDFInfo |
boolean |
setOwnerPassword(java.lang.String password)
Not in use currently
|
boolean |
setPermissionsInfo(CPDFDocumentPermissionInfo info)
Sets permission information of document, more:
CPDFDocumentPermissionInfo . |
boolean |
setUserPassword(java.lang.String password)
Sets user password.
|
boolean |
shouleReloadDocument()
Whether to reload document, true means it needs to call to reload document.
|
public static CPDFDocument createDocument()
public void setDocPtr(long docPtr)
public boolean isValid()
public boolean shouleReloadDocument()
public CPDFDocument.PDFDocumentError open(java.lang.String absolutePath)
absolutePath
- Absolute path of document.public CPDFDocument.PDFDocumentError open(java.lang.String absolutePath, java.lang.String password)
absolutePath
- Absolute path of document.password
- Document password.public java.lang.String getPassword()
public boolean isEncrypted()
public boolean isLocked()
public CPDFInfo getInfo()
CPDFInfo
public boolean setInfo(CPDFInfo info)
CPDFInfo
public int getMajorVersion()
public int getMinorVersion()
public int getReVersion()
public java.lang.String getBuildTag()
public CPDFDocument.PDFDocumentPermissions getPermissions()
CPDFDocument.PDFDocumentPermissions
.public CPDFDocumentPermissionInfo getPermissionsInfo()
CPDFDocumentPermissionInfo
public boolean setPermissionsInfo(CPDFDocumentPermissionInfo info)
CPDFDocumentPermissionInfo
.info
- Permission information.public int getPageCount()
public boolean setUserPassword(java.lang.String password)
password
- Password string.public boolean setOwnerPassword(java.lang.String password)
public boolean checkOwnerPassword(java.lang.String password)
public boolean importAnnotations(java.lang.String importFilePath, java.lang.String tmpCachePath)
importFilePath
- Path of XFDF.tmpCachePath
- Cache path.public boolean importAnnotations(java.lang.String importXPDFPath)
importXPDFPath
- Path of XFDF.public boolean exportAnnotations(java.lang.String exportXPDFPath, java.lang.String tmpCacheDirPath)
exportXPDFPath
- XFDF path.tmpCacheDirPath
- Cache dir path.public RectF getPageSize(int pageNum)
pageNum
- Page index.public java.lang.String getPageLabel(int pageNum)
pageNum
- Page index.public CPDFPage pageAtIndex(int pageNum)
CPDFPage
.pageNum
- Page index.public CPDFPage copyPage(int pageNum)
pageNum
- Page Indexpublic boolean addPage(CPDFPage page, int pageNum)
page
- Page object to add to document.pageNum
- Position to add to.public CPDFPage insertBlankPage(int pageIndex, float width, float height)
pageIndex
- Page index.width
- Page width.height
- Page height.public CPDFPage insertPageWithImagePath(int pageNum, float width, float height, java.lang.String imagePath, CPDFDocument.PDFDocumentImageMode imageMode)
pageNum
- Page.width
- Page width.height
- Page height.imagePath
- File path of image resource.imageMode
- Fill mode.public boolean importPages(CPDFDocument otherDocument, int start, int end, int insertPosition)
insertPosition
.otherDocument
- Other document.start
- Start page index.end
- End page index.insertPosition
- Insert position.public boolean importPages(CPDFDocument otherDocument, int[] pages, int insertPosition)
insertPosition
.otherDocument
- Other document.pages
- Page index array.insertPosition
- Insert position.public boolean removePages(int[] pageNums)
pageNums
- Page index array.public boolean movePage(int fromIndex, int toIndex)
fromIndex
- Source page index.toIndex
- Destination page index.public boolean exchangePage(int firstIndex, int secondIndex)
firstIndex
- The first page index.secondIndex
- The second page index.public int indexOfPage(CPDFPage page)
page
- Page object.public void releaseAllPages()
public void releaseAllWatermarks()
public void close()
public boolean hasChanges()
public boolean canSaveIncrementally()
public boolean hasRepaired()
public boolean flattenAllPages(CPDFPage.PDFFlattenOption flattenOption)
flattenOption
- flatten type, more: CPDFPage.PDFFlattenOption
public boolean saveForceByNoincremental()
public boolean save(java.lang.String absolutePath, CPDFDocument.PDFDocumentSaveType saveType)
public long getDocPtr()
public boolean save(CPDFDocument.PDFDocumentSaveType saveType)
public java.lang.String getFilePath()
public int getWatermarkCount()
public CPDFWatermark getWatermark(int index)
index
- indexpublic CPDFWatermark createWatermark(CPDFWatermark.Type type)
type
- CPDFWatermark.Typepublic CPDFCompare createCompare(CPDFDocument baseDoc, CPDFDocument compDoc)
public CPDFCompare createCompare(CPDFDocument compDoc)
public CPDFCompareDrawings createCompareDrawings(CPDFDocument compDoc)