Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.pdf.PDFDoc Class Reference
Inheritance diagram for com.foxit.sdk.pdf.PDFDoc:

## Public Member Functions
| PDFDoc () throws com.foxit.sdk.PDFException
| Constructor. More...
| PDFDoc (byte[] buffer) throws com.foxit.sdk.PDFException
| Constructor, from a memory buffer. More...
| PDFDoc (FileReaderCallback file_read, boolean is_async) throws com.foxit.sdk.PDFException
| Constructor, with a file read callback object. More...
| PDFDoc (PDFDoc other)
| Constructor, with another PDF document object. More...
| PDFDoc (String path) throws com.foxit.sdk.PDFException
| Constructor, from an existing PDF file path. More...
void | addHeaderFooter (HeaderFooter headerfooter) throws com.foxit.sdk.PDFException
| Add new header-footer. More...
int | addIndirectObject (PDFObject pdf_object) throws com.foxit.sdk.PDFException
| Add a PDF object to current PDF document, to be an indirect object. More...
PDFPage | addPageFromTemplate (String template_name) throws com.foxit.sdk.PDFException
| Adds a new PDF page to document, from a named template. More...
PagingSealSignature | addPagingSealSignature (Range page_range, float width, float height, boolean to_check_permission) throws com.foxit.sdk.PDFException
| Add a paging seal signature to document by page range. More...
void | addTableOfContents (String title, Int32Array bookmark_level_array) throws com.foxit.sdk.PDFException
| Insert page(s) as the table of contents to the front of current PDF document. More...
void | addTableOfContents (TableOfContentsConfig table_of_contents_config) throws com.foxit.sdk.PDFException
| Insert page(s) as the table of contents to the front of current PDF document. More...
int | checkPassword (byte[] password) throws com.foxit.sdk.PDFException
| Check the type of a specified password. More...
int | checkPassword (String password) throws com.foxit.sdk.PDFException
| Check the type of a specified unicode password. More...
void | clearRenderCache () throws com.foxit.sdk.PDFException
| Clear the cache used during rendering, to reduce the memory usage. More...
void | createDSS () throws com.foxit.sdk.PDFException
| Create DSS information in current PDF document. More...
Bookmark | createRootBookmark () throws com.foxit.sdk.PDFException
| Create new bookmark root node. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
void | deleteIndirectObject (int object_number) throws com.foxit.sdk.PDFException
| Delete an indirect object by indirect object number. More...
boolean | doJSOpenAction () throws com.foxit.sdk.PDFException
| Perform JavaScript actions when the document is opened. More...
boolean | exportAnnotToFDF (Annot pdf_annot, FDFDoc fdf_doc) throws com.foxit.sdk.PDFException
| Export specified annotation to a FDF/XFDF document. More...
boolean | exportFormFieldsToFDF (FieldArray field_array, boolean is_include, FDFDoc fdf_doc) throws com.foxit.sdk.PDFException
| Export specified form fields to a FDF/XFDF document. More...
boolean | exportToFDF (FDFDoc fdf_doc, int types, Range page_range) throws com.foxit.sdk.PDFException
| Export form fields and annotations to a FDF/XFDF document. More...
PageBasicInfoArray | getAllPageBasicInfo () throws com.foxit.sdk.PDFException
| Get the basic information of all page. More...
AnnotArray | getAnnotsByIdArray (WStringArray unique_id_arr)
| Get annotations by the unique ID array. More...
int | getBookmarkLevelDepth () throws com.foxit.sdk.PDFException
| Get bookmark level depth. More...
PDFDictionary | getCatalog () throws com.foxit.sdk.PDFException
| Get the catalog dictionary. More...
CertificateEncryptData | getCertificateEncryptData () throws com.foxit.sdk.PDFException
| Get encrypt data of certificate encryption. More...
CustomEncryptData | getCustomEncryptData () throws com.foxit.sdk.PDFException
| Get encrypt data of custom encryption. More...
int | getDisplayMode () throws com.foxit.sdk.PDFException
| Get the display mode. More...
DRMEncryptData | getDRMEncryptData () throws com.foxit.sdk.PDFException
| Get encrypt data of Foxit DRM encryption. More...
HeaderFooter | getEditableHeaderFooter () throws com.foxit.sdk.PDFException
| Get the editable header footer object. More...
EmbeddedFontData | getEmbeddedFontData () throws com.foxit.sdk.PDFException
| Get embedded font data. More...
PDFDictionary | getEncryptDict () throws com.foxit.sdk.PDFException
| Get the encrypt dictionary. More...
int | getEncryptionType () throws com.foxit.sdk.PDFException
| Get the encryption type. More...
java.math.BigInteger | getFileSize () throws com.foxit.sdk.PDFException
| Get file size. More...
int | getFileVersion () throws com.foxit.sdk.PDFException
| Get PDF file version stored in PDF header section. More...
int | getFirstAvailPageIndex () throws com.foxit.sdk.PDFException
| Get the page index of the fist available page. More...
Font | getFont (int index) throws com.foxit.sdk.PDFException
| Get a font by index. More...
int | getFontCount () throws com.foxit.sdk.PDFException
| Count all the PDF fonts used in current PDF document. More...
String | getHeader () throws com.foxit.sdk.PDFException
| Get PDF header identifying the version of the PDF specification to which the file conforms. More...
PDFObject | getIndirectObject (int object_number) throws com.foxit.sdk.PDFException
| Get an indirect object by indirect object number. More...
PDFDictionary | getInfo () throws com.foxit.sdk.PDFException
| Get the information dictionary. More...
Action | getOpenAction () throws com.foxit.sdk.PDFException
| Get the action to be performed when the document is opened. More...
PDFPage | getPage (int index) throws com.foxit.sdk.PDFException
| Get a PDF page by index. More...
PageBasicInfo | getPageBasicInfo (int index) throws com.foxit.sdk.PDFException
| Get the basic information of a page specified by index. More...
int | getPageCount () throws com.foxit.sdk.PDFException
| Get the count of pages. More...
PDFDictionary | getPagesDict () throws com.foxit.sdk.PDFException
| Get the dictionary of "Pages". More...
String | getPageText (int page_index) throws com.foxit.sdk.PDFException
| Get the specified PDF page text which the text is in display order. More...
int | getPasswordType () throws com.foxit.sdk.PDFException
| Get the type of current used password. More...
PayLoadData | getPayLoadData () throws com.foxit.sdk.PDFException
| Get payload data if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperPDFV2 . More...
ReadingBookmark | getReadingBookmark (int index) throws com.foxit.sdk.PDFException
| Get a reading bookmark by index. More...
int | getReadingBookmarkCount () throws com.foxit.sdk.PDFException
| Get the count of reading bookmarks. More...
RMSEncryptData | getRMSEncryptData () throws com.foxit.sdk.PDFException
| Get encrypt data of RMS encryption. More...
Bookmark | getRootBookmark () throws com.foxit.sdk.PDFException
| Get bookmark root node. More...
SecurityHandler | getSecurityHandler () throws com.foxit.sdk.PDFException
| Get current PDF security handler of current document. More...
Signature | getSignature (int index) throws com.foxit.sdk.PDFException
| Get a signature by index. More...
int | getSignatureCount () throws com.foxit.sdk.PDFException
| Get the count of signature. More...
StdEncryptData | getStdEncryptData () throws com.foxit.sdk.PDFException
| Get encrypt data of standard encryption (known as password encryption). More...
PDFDictionary | getTrailer () throws com.foxit.sdk.PDFException
| Get the trailer dictionary. More...
String | getUserPassword (byte[] owner_password) throws com.foxit.sdk.PDFException
| Get the user password based on owner password. More...
int | getUserPermissions () throws com.foxit.sdk.PDFException
| Get user access permissions. More...
WrapperData | getWrapperData () throws com.foxit.sdk.PDFException
| Get wrapper data if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit . More...
int | getWrapperOffset () throws com.foxit.sdk.PDFException
| Get wrapper offset if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit . More...
int | getWrapperType () throws com.foxit.sdk.PDFException
| Get Wrapper type. More...
boolean | hasForm () throws com.foxit.sdk.PDFException
| Check whether current PDF document has interactive form (also known as AcroForm). More...
boolean | hasHeaderFooter () throws com.foxit.sdk.PDFException
| Check whether current document has header-footer. More...
boolean | hasLayer () throws com.foxit.sdk.PDFException
| Check whether current PDF document has layer (known as "Optional content group" in <PDF reference 1.7>) or not. More...
boolean | hidePageTemplate (String template_name) throws com.foxit.sdk.PDFException
| Hide a named page. More...
boolean | importFromFDF (FDFDoc fdf_doc, int types, Range page_range) throws com.foxit.sdk.PDFException
| Import form fields and annotations from a FDF/XFDF document. More...
void | insertDocument (int dest_index, PDFDoc src_doc, int options) throws com.foxit.sdk.PDFException
| Insert another PDF document to the specified location of current PDF document. More...
void | insertDocument (int dest_index, PDFDoc src_doc, int options, String bookmark_title) throws com.foxit.sdk.PDFException
| Insert another PDF document to the specified location of current PDF document. More...
PDFPage | insertPage (int index, float width, float height) throws com.foxit.sdk.PDFException
| Insert a new blank PDF page to document, by index. More...
PDFPage | insertPage (int index, int size) throws com.foxit.sdk.PDFException
| Insert a new blank PDF page to document, by index. More...
ReadingBookmark | insertReadingBookmark (int reading_bookmark_index, String title, int dest_page_index) throws com.foxit.sdk.PDFException
| Insert a reading bookmark to current PDF document. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
boolean | isEncrypted () throws com.foxit.sdk.PDFException
| Check whether current document is an encrypted file or not. More...
boolean | isLinearized () throws com.foxit.sdk.PDFException
| Check if current PDF document is a linearized file. More...
boolean | isOwnerPassword (byte[] password) throws com.foxit.sdk.PDFException
| Check if input password is the owner password of current PDF document. More...
boolean | isOwnerPassword (String password) throws com.foxit.sdk.PDFException
| Check if input password is the owner password of current PDF document. More...
boolean | isPortfolio () throws com.foxit.sdk.PDFException
| Check whether current PDF document is a portfolio file or not. More...
boolean | isTaggedPDF () throws com.foxit.sdk.PDFException
| Check if current PDF document is a Tagged PDF file. More...
boolean | isUserPassword (byte[] password) throws com.foxit.sdk.PDFException
| Check if input password is the user password of current PDF document. More...
boolean | isUserPassword (String password) throws com.foxit.sdk.PDFException
| Check if input password is the user password of current PDF document. More...
boolean | isWrapper () throws com.foxit.sdk.PDFException
| Check whether current document is a wrapper file or not. More...
boolean | isXFA () throws com.foxit.sdk.PDFException
| Check whether current PDF document is an XFA document. More...
int | load (byte[] password) throws com.foxit.sdk.PDFException
| Load current document content by using a specified password. More...
int | loadW (String password) throws com.foxit.sdk.PDFException
| Load current document content by using a specified password. More...
boolean | movePagesTo (Range page_range, int dest_index) throws com.foxit.sdk.PDFException
| Move one or more pages (specified by index) to a new position. More...
boolean | movePageTo (PDFPage page, int dest_index) throws com.foxit.sdk.PDFException
| Move a specified page to a new position. More...
boolean | removeAllHeaderFooters () throws com.foxit.sdk.PDFException
| Remove all header-footers. More...
boolean | removeBookmark (Bookmark bookmark) throws com.foxit.sdk.PDFException
| Remove a specified bookmark. More...
void | removeHiddenInfo (HiddenInfoSettingData hidden_data_setting) throws com.foxit.sdk.PDFException
| Removes specified types of hidden information from the current PDF document based on user-defined settings. More...
boolean | removeOpenAction () throws com.foxit.sdk.PDFException
| Remove the action to be performed when the document is opened. More...
boolean | removePage (int index) throws com.foxit.sdk.PDFException
| Remove a PDF page by page index. More...
boolean | removePage (PDFPage page) throws com.foxit.sdk.PDFException
| Remove a specified PDF page. More...
boolean | removeReadingBookmark (ReadingBookmark reading_bookmark) throws com.foxit.sdk.PDFException
| Remove a reading bookmark from current PDF document. More...
boolean | removeSecurity () throws com.foxit.sdk.PDFException
| Remove the security handler from current document, so that the later saved document will be unencrypted. More...
void | removeSignature (Signature signature) throws com.foxit.sdk.PDFException
| Remove a signature. More...
void | removeStructTree ()
| Remove structure tree from current PDF document. More...
void | sanitize () throws com.foxit.sdk.PDFException
| Removes all hidden or potentially sensitive information from the current PDF document using default settings. More...
boolean | saveAs (String file_path, int save_flags) throws com.foxit.sdk.PDFException
| Save current PDF document as another PDF file. More...
boolean | saveAsWrapperFile (String file_path, WrapperData wrapper_data, int user_permissions, String owner_password) throws com.foxit.sdk.PDFException
| Save current PDF document as a wrapper file. More...
void | setCacheFile (StreamCallback file_stream, boolean is_own_file_stream) throws com.foxit.sdk.PDFException
| Set cache file (represented by a file stream) to current PDF document. More...
void | setDisplayMode (int display_mode) throws com.foxit.sdk.PDFException
| Set the display mode. More...
void | setFileVersion (int version) throws com.foxit.sdk.PDFException
| Set the PDF file version which will be stored in PDF header section of the saved PDF file. More...
boolean | setOpenAction (Action action) throws com.foxit.sdk.PDFException
| Set the action to be performed when the document is opened. More...
boolean | setSecurityHandler (SecurityHandler handler) throws com.foxit.sdk.PDFException
| Set a PDF security handler for encryption, such as standard encryption(password), certificate encryption, and so on. More...
Progressive | startAddTiledWatermark (FileReaderCallback src_img_stream, TiledWatermarkSettings settings, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Add image type tiled watermark to PDF pages by image stream. More...
Progressive | startAddTiledWatermark (PDFPage page, TiledWatermarkSettings settings, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Add page type tiled watermark to PDF pages. More...
Progressive | startAddTiledWatermark (String src_img_file_path, TiledWatermarkSettings settings, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Add image type tiled watermark to PDF pages by image path. More...
Progressive | startAddTiledWatermark (String text, TiledWatermarkSettings settings, WatermarkTextProperties properties, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Add text type tiled watermark to PDF pages. More...
Progressive | startEmbedAllFonts (PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to convert all un-embeded fonts to embeded fonts. More...
Progressive | startExtractPages (FileWriterCallback file, int options, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to extract pages from current PDF document. More...
Progressive | startExtractPages (String file_path, int options, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to extract pages from current PDF document. More...
Progressive | startGetPayloadFile (FileWriterCallback payload_file, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to get payload file. More...
Progressive | startImportPages (int dest_index, PDFDoc src_doc, int flags, String layer_name, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to import pages from another PDF document (via PDF document object). More...
Progressive | startImportPagesFromFilePath (int dest_index, String src_file_path, byte[] password, int flags, String layer_name, Range page_range, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to import pages from another PDF document (via file path). More...
Progressive | startLoad (byte[] password, boolean is_cache_stream, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to loading current document content by using a specified password. More...
Progressive | startLoadW (String password, boolean is_cache_stream, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to loading current document content by using a specified password. More...
Progressive | startRecognizeForm (boolean is_set_tool_tips, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to recognize form in current PDF document. More...
Progressive | startRecognizeForm (PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to recognize form in current PDF document. More...
Progressive | startSaveAs (FileWriterCallback file, int save_flags, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to save current PDF document as another PDF file. More...
Progressive | startSaveAs (String file_path, int save_flags, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to save current PDF document as another PDF file. More...
Progressive | startSaveAsPayloadFile (String file_path, String payload_file_path, String crypto_filter, String description, float version, int save_flags, PauseCallback pause) throws com.foxit.sdk.PDFException
| Start to save current PDF document as a wrapper document with a payload document (defined in PDF 2.0). More...
void | updateHeaderFooter (HeaderFooter headerfooter) throws com.foxit.sdk.PDFException
| Update header-footer. More...

## Static Public Attributes
static final int | e_Annots = 0x0002
| If set, annotations (except link annotations) are to imported from or exported to FDF/XFDF document.
static final int | e_DisplayFullScreen = 3
| When document is opened, full-screen mode, with no menu bar, window controls, or any other windows are visible.
static final int | e_DisplayUseAttachment = 5
| When document is opened, attachment panels are visible.
static final int | e_DisplayUseNone = 0
| When document is opened, neither document outlines nor thumbnail images are visible.
static final int | e_DisplayUseOC = 4
| When document is opened, optional content group panels are visible.
static final int | e_DisplayUseOutlines = 1
| When document is opened, document outlines (bookmarks) are visible.
static final int | e_DisplayUseThumbs = 2
| When document is opened, thumbnail images are visible.
static final int | e_EncryptCDRM = 6
| (Reserved, currently, this value is not used.) Encryption type: Foxit connected PDF DRM encryption.
static final int | e_EncryptCertificate = 2
| Encryption type: digital certificate encryption.
static final int | e_EncryptCustom = 4
| Encryption type: customized encryption.
static final int | e_EncryptFoxitDRM = 3
| Encryption type: Foxit DRM encryption.
static final int | e_EncryptNone = 0
| No encryption pattern.
static final int | e_EncryptPassword = 1
| Encryption type: password, which is the standard encryption.
static final int | e_EncryptRMS = 5
| Encryption type: Microsoft RMS encryption.
static final int | e_EncryptUnknown = -1
| Unknown encryption type.
static final int | e_ExtractPagesOptionAnnotation = 0x0001
| If set, that means annotations related to extracted pages will be extracted as well.
static final int | e_ExtractPagesOptionAttachFiles = 0x0020
| If set, that means attachment files will be extracted as well.
static final int | e_ExtractPagesOptionBookmark = 0x0040
| If set, that means bookmark will be extracted as well.
static final int | e_ExtractPagesOptionJavascript = 0x0004
| If set, that means Javascript will be extracted as well.
static final int | e_ExtractPagesOptionObjectStream = 0x0010
| If set, that means to use com.foxit.sdk.pdf.PDFDoc.e_SaveFlagXRefStream saving flag for the result file in order to reduce the size of result file.
static final int | e_ExtractPagesOptionOCProperties = 0x0008
| If set, that means OCProperties will be extracted as well.
static final int | e_ExtractPagesOptionSignature = 0x0080
| If set, that means signature will be extracted as well. It must be combined with .
static final int | e_ExtractPagesOptionStructureTree = 0x0002
| If set, that means structure tree will be extracted as well.
static final int | e_Forms = 0x0001
| If set, form fields are to imported from or exported to FDF/XFDF document.
static final int | e_ImportFlagNormal = 0
| Import pages normally.
static final int | e_ImportFlagShareStream = 0x0002
| Import pages without cloning stream objects into memory. More...
static final int | e_ImportFlagWithLayers = 0x0001
| Import pages with layers.
static final int | e_InsertDocOptionAttachments = 0x0001
| If set, that means attachments will be inserted to target document as well.
static final int | e_InsertDocOptionBookmark = 0x0002
| If set, that means bookmark will be inserted to target document as well.
static final int | e_Links = 0x0004
| (Reserved, not supported yet) If set, only link annotations are to imported from or exported to XFDF document.
static final int | e_PermAnnotForm = 0x0020
| Operate text annotations and fill in interactive form fields. (Bit 6 in permission value) More...
static final int | e_PermAssemble = 0x0400
| Assemble PDF document. (Bit 11 in permission value) More...
static final int | e_PermExtract = 0x0010
| Extract PDF contents. (Bit 5 in permission value) More...
static final int | e_PermExtractAccess = 0x0200
| Disabilities support. (Bit 10 in permission value) More...
static final int | e_PermFillForm = 0x0100
| Fill PDF form. (Bit 9 in permission value) More...
static final int | e_PermModify = 0x0008
| Modify PDF contents. (Bit 4 in permission value) More...
static final int | e_PermPrint = 0x0004
| Print PDF document with normal mode. (Bit 3 in permission value) More...
static final int | e_PermPrintHigh = 0x0800
| Print PDF document with higher qualities. (Bit 12 in permission value) More...
static final int | e_PwdInvalid = 0
| The password is invalid.
static final int | e_PwdNoPassword = 1
| No password is used in PDF document.
static final int | e_PwdOwner = 3
| An owner password is used in PDF document.
static final int | e_PwdUser = 2
| A user password is used in PDF document.
static final int | e_SaveFlagIncremental = 0x0001
| Save document incrementally. More...
static final int | e_SaveFlagLinearized = 0x1000
| Save document as a linearized file. More...
static final int | e_SaveFlagNoOriginal = 0x0002
| Save document without original data or unchanged objects. More...
static final int | e_SaveFlagNormal = 0
| Save document normally, without using any special flag. More...
static final int | e_SaveFlagNoUpdatingMetadataDateTime = 0x0020
| Save document without updating metadata "ModDate" and "CreationDate". More...
static final int | e_SaveFlagRemoveRedundantObjects = 0x0010
| Save document with removing redundant PDF objects. More...
static final int | e_SaveFlagXRefStream = 0x0008
| Save document by using XRef stream. More...
static final int | e_WrapperFoxit = 1
| Foxit wrapper document.
static final int | e_WrapperNone = 0
| Normal document.
static final int | e_WrapperPDFV2 = 2
| PDF 2.0 wrapper document.

## Detailed Description

A PDF document object can be constructed with an existing PDF file from file path, memory buffer, a custom implemented com.foxit.sdk.common.fxcrt.FileReaderCallback object and an input file stream. And then call function pdf.PDFDoc.load or PDFDoc.startLoad to load document content. This class offers functions to retrieve different part of a PDF document. For example:

- To retrieve pages, please use functions pdf.PDFDoc.getPageCount and PDFDoc.getPage .
- To retrieve bookmark, such as function pdf.PDFDoc.getRootBookmark , PDFDoc.createRootBookmark , etc.
- To retrieve some document's dictionaries (in low-level), such as functions pdf.PDFDoc.getCatalog , PDFDoc.getTrailer , etc.
- To retrieve reading bookmark, such as functions PDFDoc.getReadingBookmarkCount , PDFDoc.getReadingBookmark , etc.
- To check if a PDF document has interactive form, please use function PDFDoc.hasForm .
- To check if a PDF document has header-footer, please use function PDFDoc.hasHeaderFooter . To modify header- footer, please refer to functions such as pdf.PDFDoc.addHeaderFooter , PDFDoc.updateHeaderFooter , and PDFDoc.removeAllHeaderFooters .

This class also offers functions for features, such as saving current document as another PDF file, importing pages from another PDF file, setting security handler in order to save encrypted PDF file, and so on.
This class object can also be used to construct objects of other classes in order to access specified information in PDF document:

- To access form, please construct a com.foxit.sdk.pdf.interform.Form object with PDF document object.
- To access additional actions, please construct an com.foxit.sdk.pdf.actions.AdditionalAction object with PDF document object.
- To access viewer preferences information, please construct a DocViewerPrefs object with PDF document object.
- To access metadata information, please construct a Metadata object with PDF document object.
- To manage page labels information, please construct a PageLabels object with PDF document object.
- To search among a PDF file, please construct a TextSearch object with PDF document object.
- To access layers, please construct a LayerTree object with PDF document object. And to render layers, please constructor a LayerContext object with PDF document object.
- To construct a new FileSpec object.
- To manage associated files, please construct an AssociatedFiles object with PDF document object.
- To access name tree, please construct a com.foxit.sdk.pdf.objects.PDFNameTree object with PDF document object. Specially, for EmbeddedFiles name tree, an Attachments object can be constructed with PDF document object, for convenient use.
- To do redaction, please construct a com.foxit.sdk.addon.Redaction object with PDF document object.

See also
  com.foxit.sdk.pdf.interform.Form
  com.foxit.sdk.pdf.actions.AdditionalAction
  DocViewerPrefs
  Metadata
  PageLabels
  TextSearch
  LayerTree
  LayerContext
  FileSpec
  AssociatedFiles
  com.foxit.sdk.pdf.objects.PDFNameTree
  Attachments
  com.foxit.sdk.addon.Redaction

## Constructor & Destructor Documentation

## ◆ PDFDoc() [1/5]

com.foxit.sdk.pdf.PDFDoc.PDFDoc | ( |  | ) | throws com.foxit.sdk.PDFException

Constructor.

This constructor is to construct a new PDF document (without any data). The file version value would be 17 (as PDF version 1.7) by default.

## ◆ PDFDoc() [2/5]

com.foxit.sdk.pdf.PDFDoc.PDFDoc | ( | String | path | ) | throws com.foxit.sdk.PDFException

Constructor, from an existing PDF file path.

After constructing such a PDF document object, please ensure the document object has been loaded before using most functions in class PDFDoc .

Parameters

  [in] | path | A full path of an existing PDF file. It should not be an empty string.

## ◆ PDFDoc() [3/5]

com.foxit.sdk.pdf.PDFDoc.PDFDoc | ( | byte[] | buffer | ) | throws com.foxit.sdk.PDFException

Constructor, from a memory buffer.

After constructing such a PDF document object, please ensure the document object has been loaded before using most functions in class PDFDoc .

Parameters

  [in] | buffer | A memory buffer, containing the serialized document. The PDF document data should be fully loaded in this memory buffer. It should not be null.

## ◆ PDFDoc() [4/5]

com.foxit.sdk.pdf.PDFDoc.PDFDoc | ( | FileReaderCallback | file_read,
|  | boolean | is_async
| ) |  | throws com.foxit.sdk.PDFException

Constructor, with a file read callback object.

After constructing such a PDF document object, please ensure the document object has been loaded before using most functions in class PDFDoc .

Parameters

  [in] | file_read | A com.foxit.sdk.common.fxcrt.FileReaderCallback object which is implemented by user to load a PDF document. It should not be null. If the input callback object is an com.foxit.sdk.common.file.AsyncReaderCallback object, and is_async is true that means the PDF document will be loaded by asynchronous method; otherwise, the document will be loaded in common way.
  [in] | is_async | Whether the input com.foxit.sdk.common.fxcrt.FileReaderCallback object is for asynchronously loading or not. Default value: false.

## ◆ PDFDoc() [5/5]

com.foxit.sdk.pdf.PDFDoc.PDFDoc | ( | PDFDoc | other | ) |

Constructor, with another PDF document object.

Parameters

  [in] | other | Another PDF document object.

## Member Function Documentation

## ◆ addHeaderFooter()

void com.foxit.sdk.pdf.PDFDoc.addHeaderFooter | ( | HeaderFooter | headerfooter | ) | throws com.foxit.sdk.PDFException

Add new header-footer.

A PDF document can be added header-footer sereral times. When a new header-footer is added, the old ones will not be removed but be covered by the new one if the old ones appear in the same place as new one.

Parameters

  [in] | headerfooter | A valid header-footer object to be added to current document.

Returns
  None.

## ◆ addIndirectObject()

int com.foxit.sdk.pdf.PDFDoc.addIndirectObject | ( | PDFObject | pdf_object | ) | throws com.foxit.sdk.PDFException

Add a PDF object to current PDF document, to be an indirect object.

- If input PDF object is a direct object (whose indirect object number is 0), this functions will change it to be an indirect object and add to PDF document. Then return the new indirect object number.
- If input PDF object is already an indirect object (whose indirect object number is above 0), this function will not add it into document again. The return value will be its own indirect object number.

Parameters

  [in] | pdf_object | A com.foxit.sdk.pdf.objects.PDFObject object. It should not be null.

Returns
  The new indirect object number. It would be above 0.

## ◆ addPageFromTemplate()

PDFPage com.foxit.sdk.pdf.PDFDoc.addPageFromTemplate | ( | String | template_name | ) | throws com.foxit.sdk.PDFException

Adds a new PDF page to document, from a named template.

There may exist hidden pages in a PDF document. Hidden pages are mapped to the names defined in the template name tree in the PDF document. This function can be used to add a hidden page to the end of the PDF document.
Class com.foxit.sdk.pdf.objects.PDFNameTree (initialized with type com.foxit.sdk.pdf.objects.PDFNameTree.e_Templates ) can be used to determine which template names are available.
After a template has been added, the name will be moved to the document's pages name tree internally.

Parameters

  [in] | template_name | The name of a template, whose mapping hidden page will be added to the end of current PDF document. If the template name cannot be found, exception com.foxit.sdk.common.Constants.e_ErrParam will be thrown.

Returns
  A new PDF page object if input template name was found.

## ◆ addPagingSealSignature()

PagingSealSignature com.foxit.sdk.pdf.PDFDoc.addPagingSealSignature | ( | Range | page_range,
|  | float | width,
|  | float | height,
|  | boolean | to_check_permission
| ) |  | throws com.foxit.sdk.PDFException

Add a paging seal signature to document by page range.

This function will add a signature to the first page of page_range.

Parameters

  [in] | page_range | A range object that specifies some pages. These pages will be added a signature. The valid page range: from 1 to count. count is returned by function PDFDoc.getPageCount . If this range object is constructed by default constructor and not set any value, that means all the pages of current document will be added a signature. This function does not support a range with a single index or a document with a single page.
  [in] | width | The width of paging seal. The value will be used for setting rectangle of the signature on each page.
  [in] | height | The height of paging seal. The value will be used for setting rectangle of the signature on each page.
  [in] | to_check_permission | A boolean value to decide whether Foxit PDF SDK should check PDF document's permission before adding signature: true means Foxit PDF SDK should check document permission to decide if adding signature is allowed, while false means Foxit PDF SDK should not check document permission before adding signature. When this parameter is false, user should ensure to check document permission to check if adding signature is allowed. Default value: true.

Returns
  A paging seal signature object.

## ◆ addTableOfContents() [1/2]

void com.foxit.sdk.pdf.PDFDoc.addTableOfContents | ( | String | title,
|  | Int32Array | bookmark_level_array
| ) |  | throws com.foxit.sdk.PDFException

Insert page(s) as the table of contents to the front of current PDF document.

If the current document does not have any bookmark, this function will do nothing.

Parameters

  [in] | title | Title for the table of contents. If this is an empty string, the default value "Table of Contents" will be used.
  [in] | bookmark_level_array | A bookmark level array which is used to specify bookmarks to be used to generate "Table of Contents". For each element in input array, valid range: from 1 to (depth). depth is returned by function PDFDoc.getBookmarkLevelDepth . If input array is an empty array, that means all bookmarks are used to generate "Table of Contents".

Returns
  None.

## ◆ addTableOfContents() [2/2]

void com.foxit.sdk.pdf.PDFDoc.addTableOfContents | ( | TableOfContentsConfig | table_of_contents_config | ) | throws com.foxit.sdk.PDFException

Insert page(s) as the table of contents to the front of current PDF document.

If the current document does not have any bookmark, this function will do nothing.

Parameters

  [in] | table_of_contents_config | A table of contents configuration object which is used for the table of contents.

Returns
  None.

## ◆ checkPassword() [1/2]

int com.foxit.sdk.pdf.PDFDoc.checkPassword | ( | byte[] | password | ) | throws com.foxit.sdk.PDFException

Check the type of a specified password.

This function can be used to check the type of any password string, including the password string used for loading document content.
Some PDF documents may have user password and owner password at the same time and these two passwords are same. But current function can only return one type for such password. In this case, functions PDFDoc.isUserPassword and PDFDoc.isOwnerPassword can help to do more check.

Parameters

  [in] | password | A password string to be detected.

Returns
  Password type. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_PwdInvalid and this would be one of these values.

## ◆ checkPassword() [2/2]

int com.foxit.sdk.pdf.PDFDoc.checkPassword | ( | String | password | ) | throws com.foxit.sdk.PDFException

Check the type of a specified unicode password.

This function can be used to check the type of any password string, including the password string used for loading document content.
For some PDF document, it have user password and owner password at the same time and these two passwords are same. But current function can only return one type for such password. In this case, functions PDFDoc.isUserPassword and PDFDoc.isOwnerPassword can help to do more check.

Parameters

  [in] | password | A unicode password string to be detected.

Returns
  Password type. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_PwdInvalid and this would be one of these values.

## ◆ clearRenderCache()

void com.foxit.sdk.pdf.PDFDoc.clearRenderCache | ( |  | ) | throws com.foxit.sdk.PDFException

Clear the cache used during rendering, to reduce the memory usage.

Returns
  None.

## ◆ createDSS()

void com.foxit.sdk.pdf.PDFDoc.createDSS | ( |  | ) | throws com.foxit.sdk.PDFException

Create DSS information in current PDF document.

If current PDF document already has DSS information, this function will do nothing and return directly.

Returns
  None.

## ◆ createRootBookmark()

Bookmark com.foxit.sdk.pdf.PDFDoc.createRootBookmark | ( |  | ) | throws com.foxit.sdk.PDFException

Create new bookmark root node.

If current PDF document already has the bookmark root node, this function will remove the old bookmark tree and create a new root node instead.

Returns
  A bookmark object that represents the root bookmark.

## ◆ delete()

synchronized void com.foxit.sdk.pdf.PDFDoc.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

Reimplemented from com.foxit.sdk.common.Base.

## ◆ deleteIndirectObject()

void com.foxit.sdk.pdf.PDFDoc.deleteIndirectObject | ( | int | object_number | ) | throws com.foxit.sdk.PDFException

Delete an indirect object by indirect object number.

Parameters

  [in] | object_number | The indirect object number. It should be above 0.

Returns
  None.

## ◆ doJSOpenAction()

boolean com.foxit.sdk.pdf.PDFDoc.doJSOpenAction | ( |  | ) | throws com.foxit.sdk.PDFException

Perform JavaScript actions when the document is opened.

Returns
  true means success, while false means failure.

## ◆ exportAnnotToFDF()

boolean com.foxit.sdk.pdf.PDFDoc.exportAnnotToFDF | ( | Annot | pdf_annot,
|  | FDFDoc | fdf_doc
| ) |  | throws com.foxit.sdk.PDFException

Export specified annotation to a FDF/XFDF document.

Parameters

  [in] | pdf_annot | A valid PDF annotation object to be exported to the FDF/XFDF document.
  [in] | fdf_doc | A valid FDF/XFDF document object, to which the specified annotation will be exported.

Returns
  true means success, while false means failure.

## ◆ exportFormFieldsToFDF()

boolean com.foxit.sdk.pdf.PDFDoc.exportFormFieldsToFDF | ( | FieldArray | field_array,
|  | boolean | is_include,
|  | FDFDoc | fdf_doc
| ) |  | throws com.foxit.sdk.PDFException

Export specified form fields to a FDF/XFDF document.

Parameters

  [in] | field_array | An array of form fields. Parameter is_include will decide whether data of these form fields are to exported or not.
  [in] | is_include | A boolean value used to decide whether data of specified form fields are to be exported or not: true means data of specified form fields are to be exported, while false means data of specified form fields are not to be exported.
  [in] | fdf_doc | A valid FDF/XFDF document object, to which the specified form fields will be exported.

Returns
  true means success, while false means failure.

## ◆ exportToFDF()

boolean com.foxit.sdk.pdf.PDFDoc.exportToFDF | ( | FDFDoc | fdf_doc,
|  | int | types,
|  | Range | page_range
| ) |  | throws com.foxit.sdk.PDFException

Export form fields and annotations to a FDF/XFDF document.

For more details about the type of PDF object available for exporting, please refer to Page 22 of "XML Forms Data Format Specification".

Parameters

  [in] | fdf_doc | A valid FDF/XFDF document object, to which form fields and annotations will be exported.
  [in] | types | Used to decide which kind of data will be exported. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_Forms and this can be one or a combination of these values. Default value: (com.foxit.sdk.pdf.PDFDoc.e_Forms | com.foxit.sdk.pdf.PDFDoc.e_Annots ).
  [in] | page_range | A range object that specifies some pages. Data (in specified types) in these pages will be exported to FDF/XFDF document. If this range object is constructed by default constructor and not set any value, that means all the data (in specified types) of current document will be exported to FDF/XFDF document. This parameter is only useful when parameter types contains com.foxit.sdk.pdf.PDFDoc.e_Annots . Default value: a range object by default constructor and not set any value.

Returns
  true means success, while false means failure.

## ◆ getAllPageBasicInfo()

PageBasicInfoArray com.foxit.sdk.pdf.PDFDoc.getAllPageBasicInfo | ( |  | ) | throws com.foxit.sdk.PDFException

Get the basic information of all page.

This function can quickly get the basic information of a PDF page without getting that PDF page object. If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may throw exception com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Returns
  The array of all page basic information object which contains the basic information of specified page, sort arrays in ascending order by page.

## ◆ getAnnotsByIdArray()

AnnotArray com.foxit.sdk.pdf.PDFDoc.getAnnotsByIdArray | ( | WStringArray | unique_id_arr | ) |

Get annotations by the unique ID array.

Parameters

  [in] | unique_id_arr | The array of unique ID. The unique ID is renturned by function annots.Annot.getUniqueID .

Returns
  An array of com.foxit.sdk.pdf.annots.Annot object.

## ◆ getBookmarkLevelDepth()

int com.foxit.sdk.pdf.PDFDoc.getBookmarkLevelDepth | ( |  | ) | throws com.foxit.sdk.PDFException

Get bookmark level depth.

Returns
  The depth of bookmark level. If current document does not have any bookmark, zero will be returned.

## ◆ getCatalog()

PDFDictionary com.foxit.sdk.pdf.PDFDoc.getCatalog | ( |  | ) | throws com.foxit.sdk.PDFException

Get the catalog dictionary.

Returns
  The catalog dictionary. If there is no catalog dictionary or any error occurs, this function will return null.

## ◆ getCertificateEncryptData()

CertificateEncryptData com.foxit.sdk.pdf.PDFDoc.getCertificateEncryptData | ( |  | ) | throws com.foxit.sdk.PDFException

Get encrypt data of certificate encryption.

This function is useful when current document is encrypted by certificate.

Returns
  The encrypt data of certificate encryption.

## ◆ getCustomEncryptData()

CustomEncryptData com.foxit.sdk.pdf.PDFDoc.getCustomEncryptData | ( |  | ) | throws com.foxit.sdk.PDFException

Get encrypt data of custom encryption.

This function is useful when current document is encrypted by custom.

Returns
  The encrypt data of custom encryption.

## ◆ getDisplayMode()

int com.foxit.sdk.pdf.PDFDoc.getDisplayMode | ( |  | ) | throws com.foxit.sdk.PDFException

Get the display mode.

Display mode specifies how the document should be displayed when opened.

Returns
  Display mode value. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_DisplayUseNone and this would be one of these values.

## ◆ getDRMEncryptData()

DRMEncryptData com.foxit.sdk.pdf.PDFDoc.getDRMEncryptData | ( |  | ) | throws com.foxit.sdk.PDFException

Get encrypt data of Foxit DRM encryption.

This function is useful when current document is encrypted by Foxit DRM.

Returns
  The encrypt data of Foxit DRM encryption.

## ◆ getEditableHeaderFooter()

HeaderFooter com.foxit.sdk.pdf.PDFDoc.getEditableHeaderFooter | ( |  | ) | throws com.foxit.sdk.PDFException

Get the editable header footer object.

A PDF document may have been added header-footer sereral times, but only one of these header-footer can be editable. This function is to retreive the editable header-footer.

Returns
  A header-footer object that represents the editable header-footer.

## ◆ getEmbeddedFontData()

EmbeddedFontData com.foxit.sdk.pdf.PDFDoc.getEmbeddedFontData | ( |  | ) | throws com.foxit.sdk.PDFException

Get embedded font data.

This function is used for unembbeding font in "Optimizer" model.

Returns
  The embedded font data.

## ◆ getEncryptDict()

PDFDictionary com.foxit.sdk.pdf.PDFDoc.getEncryptDict | ( |  | ) | throws com.foxit.sdk.PDFException

Get the encrypt dictionary.

Returns
  The encrypt dictionary. If there is no encrypt dictionary or any error occurs, this function will return null.

## ◆ getEncryptionType()

int com.foxit.sdk.pdf.PDFDoc.getEncryptionType | ( |  | ) | throws com.foxit.sdk.PDFException

Get the encryption type.

Returns
  Encryption type. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_EncryptNone and this would be one of these values.

## ◆ getFileSize()

java.math.BigInteger com.foxit.sdk.pdf.PDFDoc.getFileSize | ( |  | ) | throws com.foxit.sdk.PDFException

Get file size.

Returns
  File size.

## ◆ getFileVersion()

int com.foxit.sdk.pdf.PDFDoc.getFileVersion | ( |  | ) | throws com.foxit.sdk.PDFException

Get PDF file version stored in PDF header section.

Returns
  The file version. For example value 14 means version "1.4", value 15 means "1.5", and etc.

## ◆ getFirstAvailPageIndex()

int com.foxit.sdk.pdf.PDFDoc.getFirstAvailPageIndex | ( |  | ) | throws com.foxit.sdk.PDFException

Get the page index of the fist available page.

This is useful for a linearized PDF document because in a linearized PDF document the first available page may not be the first page.
This function can be used only when document is loaded successfully.

Returns
  Page index of the first available page.

## ◆ getFont()

Font com.foxit.sdk.pdf.PDFDoc.getFont | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get a font by index.

Parameters

  [in] | index | The index of PDF font. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getFontCount .

Returns
  A font object.

## ◆ getFontCount()

int com.foxit.sdk.pdf.PDFDoc.getFontCount | ( |  | ) | throws com.foxit.sdk.PDFException

Count all the PDF fonts used in current PDF document.

This function will enumerate all the font resources used for pages, annotations, and interactive form.

Returns
  The count of fonts.

## ◆ getHeader()

String com.foxit.sdk.pdf.PDFDoc.getHeader | ( |  | ) | throws com.foxit.sdk.PDFException

Get PDF header identifying the version of the PDF specification to which the file conforms.

Returns
  The PDF header string. It would be like "PDF-1.4", "PDF-1.5" and etc.

## ◆ getIndirectObject()

PDFObject com.foxit.sdk.pdf.PDFDoc.getIndirectObject | ( | int | object_number | ) | throws com.foxit.sdk.PDFException

Get an indirect object by indirect object number.

Parameters

  [in] | object_number | The indirect object number. It should be above 0.

Returns
  A com.foxit.sdk.pdf.objects.PDFObject object that receives the indirect PDF object. null means not found.

## ◆ getInfo()

PDFDictionary com.foxit.sdk.pdf.PDFDoc.getInfo | ( |  | ) | throws com.foxit.sdk.PDFException

Get the information dictionary.

Document's information dictionary contains metadata for the document.

Returns
  The information dictionary. If there is no "Info" entry or any error occurs, this function will return null.

## ◆ getOpenAction()

Action com.foxit.sdk.pdf.PDFDoc.getOpenAction | ( |  | ) | throws com.foxit.sdk.PDFException

Get the action to be performed when the document is opened.

Returns
  An Action object.

## ◆ getPage()

PDFPage com.foxit.sdk.pdf.PDFDoc.getPage | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get a PDF page by index.

If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may throw exception com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Parameters

  [in] | index | The page index. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getPageCount .

Returns
  A PDF page object.

## ◆ getPageBasicInfo()

PageBasicInfo com.foxit.sdk.pdf.PDFDoc.getPageBasicInfo | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get the basic information of a page specified by index.

This function can quickly get the basic information of a PDF page without getting that PDF page object. If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may throw exception com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Parameters

  [in] | index | The page index. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getPageCount .

Returns
  A page basic information object which contains the basic information of specified page.

## ◆ getPageCount()

int com.foxit.sdk.pdf.PDFDoc.getPageCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get the count of pages.

Returns
  The count of pages.

## ◆ getPagesDict()

PDFDictionary com.foxit.sdk.pdf.PDFDoc.getPagesDict | ( |  | ) | throws com.foxit.sdk.PDFException

Get the dictionary of "Pages".

Returns
  The dictionary of "Pages". If there is no "Pages" entry or any error occurs, this function will return null.

## ◆ getPageText()

String com.foxit.sdk.pdf.PDFDoc.getPageText | ( | int | page_index | ) | throws com.foxit.sdk.PDFException

Get the specified PDF page text which the text is in display order.

Parameters

  [in] | page_index | The page index. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getPageCount .

Returns
  All the text content of the related PDF page which the text is in display order.

## ◆ getPasswordType()

int com.foxit.sdk.pdf.PDFDoc.getPasswordType | ( |  | ) | throws com.foxit.sdk.PDFException

Get the type of current used password.

This function is useful after loading a PDF document, in order to get the type of the password which was used in the loading process.
If current document is a new one (not loading from existed PDF file), this function will return com.foxit.sdk.pdf.PDFDoc.e_PwdNoPassword .
If current document is constructed from an existing file but has not been loaded yet, this function will return com.foxit.sdk.pdf.PDFDoc.e_PwdInvalid .

Returns
  Password type. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_PwdInvalid and this would be one of these values.

## ◆ getPayLoadData()

PayLoadData com.foxit.sdk.pdf.PDFDoc.getPayLoadData | ( |  | ) | throws com.foxit.sdk.PDFException

Get payload data if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperPDFV2 .

Returns
  The payload data. If no wrapper data can be found or current document's wrapper type is not com.foxit.sdk.pdf.PDFDoc.e_WrapperPDFV2 , a payload data object with value 0 and empty strings will be returned.

## ◆ getReadingBookmark()

ReadingBookmark com.foxit.sdk.pdf.PDFDoc.getReadingBookmark | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get a reading bookmark by index.

Parameters

  [in] | index | The index of reading bookmarks. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getReadingBookmarkCount .

Returns
  The reading bookmark object with specified index.

## ◆ getReadingBookmarkCount()

int com.foxit.sdk.pdf.PDFDoc.getReadingBookmarkCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get the count of reading bookmarks.

Returns
  The count of reading bookmarks.

## ◆ getRMSEncryptData()

RMSEncryptData com.foxit.sdk.pdf.PDFDoc.getRMSEncryptData | ( |  | ) | throws com.foxit.sdk.PDFException

Get encrypt data of RMS encryption.

This function is useful when current document is encrypted by RMS.

Returns
  The encrypt data of RMS encryption.

Note
  If module "RMS" is not defined in the license information which is used in function common.Library.initialize , that means user has no right in using RMS related functions and this function will throw exception com.foxit.sdk.common.Constants.e_ErrNoRMSModuleRight .

## ◆ getRootBookmark()

Bookmark com.foxit.sdk.pdf.PDFDoc.getRootBookmark | ( |  | ) | throws com.foxit.sdk.PDFException

Get bookmark root node.

Returns
  A bookmark object that represents the root bookmark. If there is no bookmark in current PDF document, this function will return a bookmark object which's function Bookmark.isEmpty returns true.

## ◆ getSecurityHandler()

SecurityHandler com.foxit.sdk.pdf.PDFDoc.getSecurityHandler | ( |  | ) | throws com.foxit.sdk.PDFException

Get current PDF security handler of current document.

Returns
  The PDF security handler object.

Note
  If module "RMS" is not defined in the license information which is used in function common.Library.initialize , that means user has no right in using RMS related functions and this function will throw exception com.foxit.sdk.common.Constants.e_ErrNoRMSModuleRight .

## ◆ getSignature()

Signature com.foxit.sdk.pdf.PDFDoc.getSignature | ( | int | index | ) | throws com.foxit.sdk.PDFException

Get a signature by index.

Parameters

  [in] | index | The index of signature. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getSignatureCount .

Returns
  The signature object.

## ◆ getSignatureCount()

int com.foxit.sdk.pdf.PDFDoc.getSignatureCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get the count of signature.

Returns
  The count of signature.

## ◆ getStdEncryptData()

StdEncryptData com.foxit.sdk.pdf.PDFDoc.getStdEncryptData | ( |  | ) | throws com.foxit.sdk.PDFException

Get encrypt data of standard encryption (known as password encryption).

This function is useful when current document is encrypted by password.

Returns
  The encrypt data of standard encryption.

## ◆ getTrailer()

PDFDictionary com.foxit.sdk.pdf.PDFDoc.getTrailer | ( |  | ) | throws com.foxit.sdk.PDFException

Get the trailer dictionary.

Returns
  The trailer dictionary. If there is no trailer dictionary or any error occurs, this function will return null.

## ◆ getUserPassword()

String com.foxit.sdk.pdf.PDFDoc.getUserPassword | ( | byte[] | owner_password | ) | throws com.foxit.sdk.PDFException

Get the user password based on owner password.

This function is useful when current document is encrypted by password.

Parameters

  [in] | owner_password | Owner password string.

Returns
  The user password string.

## ◆ getUserPermissions()

int com.foxit.sdk.pdf.PDFDoc.getUserPermissions | ( |  | ) | throws com.foxit.sdk.PDFException

Get user access permissions.

Returns
  User access permission. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_PermPrint and this would be one of these values.

## ◆ getWrapperData()

WrapperData com.foxit.sdk.pdf.PDFDoc.getWrapperData | ( |  | ) | throws com.foxit.sdk.PDFException

Get wrapper data if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit .

Returns
  The wrapper data. If no wrapper data can be found or current document's wrapper type is not com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit , a wrapper data object with value 0 and empty strings will be returned.

## ◆ getWrapperOffset()

int com.foxit.sdk.pdf.PDFDoc.getWrapperOffset | ( |  | ) | throws com.foxit.sdk.PDFException

Get wrapper offset if current document's wrapper type is com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit .

Returns
  The wrapper offset. If no wrapper data can be found or current document's wrapper type is not com.foxit.sdk.pdf.PDFDoc.e_WrapperFoxit , -1 will be returned.

## ◆ getWrapperType()

int com.foxit.sdk.pdf.PDFDoc.getWrapperType | ( |  | ) | throws com.foxit.sdk.PDFException

Get Wrapper type.

Returns
  The wrapper type. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_WrapperNone and this would be one or combination of its values.

## ◆ hasForm()

boolean com.foxit.sdk.pdf.PDFDoc.hasForm | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current PDF document has interactive form (also known as AcroForm).

If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may throw exception com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Returns
  true means current document has interactive form. false means current document does not have interactive form.

## ◆ hasHeaderFooter()

boolean com.foxit.sdk.pdf.PDFDoc.hasHeaderFooter | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current document has header-footer.

Returns
  true means current document has header-footer, while false means current document does not have header-footer.

## ◆ hasLayer()

boolean com.foxit.sdk.pdf.PDFDoc.hasLayer | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current PDF document has layer (known as "Optional content group" in <PDF reference 1.7>) or not.

Returns
  true means current document has layer. false means current document does not have layer.

## ◆ hidePageTemplate()

boolean com.foxit.sdk.pdf.PDFDoc.hidePageTemplate | ( | String | template_name | ) | throws com.foxit.sdk.PDFException

Hide a named page.

Pages in a PDF document can be mapped to names defined in the pages name tree in the PDF document. This function can be used to hide these named pages.
Class com.foxit.sdk.pdf.objects.PDFNameTree (initialized with type com.foxit.sdk.pdf.objects.PDFNameTree.e_Pages ) can be used to determine which page names are available and to map pages to names.
After a PDF page has been hidden, the name will be moved to the document's templates name tree internally.

Parameters

  [in] | template_name | The name of a PDF page to be hidden.

Returns
  true means success, while false means failure.

## ◆ importFromFDF()

boolean com.foxit.sdk.pdf.PDFDoc.importFromFDF | ( | FDFDoc | fdf_doc,
|  | int | types,
|  | Range | page_range
| ) |  | throws com.foxit.sdk.PDFException

Import form fields and annotations from a FDF/XFDF document.

It also supports to import form fields in FDF template. The page associated with the FDF template will be inserted into the end of document. For more details about the type of PDF object available for exporting, please refer to Page 22 of "XML Forms Data Format Specification".

Parameters

  [in] | fdf_doc | A valid FDF/XFDF document object, from which form fields and annotations will be imported.
  [in] | types | Used to decide which kind of data will be imported. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_Forms and this can be one or a combination of these values. Default value: (com.foxit.sdk.pdf.PDFDoc.e_Forms | com.foxit.sdk.pdf.PDFDoc.e_Annots ). It does not work if fdf_doc is the fdf template.
  [in] | page_range | A range object that specifies some pages. Data (in specified types) from FDF/XFDF document will be imported to these specified pages. If this range object is constructed by default constructor and not set any value, that means data (in specified types) from FDF/XFDF document will be imported to related PDF pages whose index have been defined in FDF/XFDF document. This parameter is only useful when parameter types contains com.foxit.sdk.pdf.PDFDoc.e_Annots . Default value: a range object by default constructor and not set any value. It does not work if fdf_doc is the fdf template.

Returns
  true means success, while false means failure.

## ◆ insertDocument() [1/2]

void com.foxit.sdk.pdf.PDFDoc.insertDocument | ( | int | dest_index,
|  | PDFDoc | src_doc,
|  | int | options
| ) |  | throws com.foxit.sdk.PDFException

Insert another PDF document to the specified location of current PDF document.

Parameters

  [in] | dest_index | A page index in current PDF document. This is used to specify where to insert the pages from src_doc: If parameter dest_index is less than 0, these pages will be inserted to the first. If parameter dest_index is equal to or larger than current page count, these pages will be inserted to the end.
  [in] | src_doc | A PDF document object which represents the PDF document to be inserted to current PDF document. All the pages in this document will be inserted to current PDF document. Please keep this source PDF document object valid until current document will not be saved any more or is closed.
  [in] | options | Options for inserting a PDF document. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_InsertDocOptionAttachments and this can be one or a combination of these values. 0 means no option is used.

Returns
  None.

## ◆ insertDocument() [2/2]

void com.foxit.sdk.pdf.PDFDoc.insertDocument | ( | int | dest_index,
|  | PDFDoc | src_doc,
|  | int | options,
|  | String | bookmark_title
| ) |  | throws com.foxit.sdk.PDFException

Insert another PDF document to the specified location of current PDF document.

Parameters

  [in] | dest_index | A page index in current PDF document. This is used to specify where to insert the pages from src_doc: If parameter dest_index is less than 0, these pages will be inserted to the first. If parameter dest_index is equal to or larger than current page count, these pages will be inserted to the end.
  [in] | src_doc | A PDF document object which represents the PDF document to be inserted to current PDF document. All the pages in this document will be inserted to current PDF document. Please keep this source PDF document object valid until current document will not be saved any more or is closed.
  [in] | options | Options for inserting a PDF document. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_InsertDocOptionAttachments and this can be one or a combination of these values. 0 means no option is used.
  [in] | bookmark_title | The title of the bookmark. Default value: InsertBookMark.

Returns
  None.

## ◆ insertPage() [1/2]

PDFPage com.foxit.sdk.pdf.PDFDoc.insertPage | ( | int | index,
|  | float | width,
|  | float | height
| ) |  | throws com.foxit.sdk.PDFException

Insert a new blank PDF page to document, by index.

Parameters

  [in] | index | The page index for new page. If parameter index is less than 0, the new page will be inserted to the first. If parameter index is equal to or larger than current page count, the new page will be inserted to the end.
  [in] | width | Width of new page (unit is 1/72 inch).
  [in] | height | Height of new page (unit is 1/72 inch).

Returns
  A new PDF page object which represents a blank page.

## ◆ insertPage() [2/2]

PDFPage com.foxit.sdk.pdf.PDFDoc.insertPage | ( | int | index,
|  | int | size
| ) |  | throws com.foxit.sdk.PDFException

Insert a new blank PDF page to document, by index.

Parameters

  [in] | index | The page index for new page. If parameter index is less than 0, the new page will be inserted to the first. If parameter index is equal to or larger than current page count, the new page will be inserted to the end.
  [in] | size | Size type of new page. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_SizeLetter and this should be one of these values. Default value: com.foxit.sdk.pdf.PDFPage.e_SizeLetter .

Returns
  A new PDF page object, which represents a blank page.

## ◆ insertReadingBookmark()

ReadingBookmark com.foxit.sdk.pdf.PDFDoc.insertReadingBookmark | ( | int | reading_bookmark_index,
|  | String | title,
|  | int | dest_page_index
| ) |  | throws com.foxit.sdk.PDFException

Insert a reading bookmark to current PDF document.

Parameters

  [in] | reading_bookmark_index | A reading bookmark index. If reading_bookmark_index is less than 0, the new reading bookmark will be inserted to the first. If reading_bookmark_index is equal to or larger than the count of reading bookmarks, the new reading bookmark will be inserted to the end.
  [in] | title | Title string for new reading bookmark and should not an empty string.
  [in] | dest_page_index | The index of destination page.

Returns
  A new reading bookmark object.

## ◆ isEmpty()

boolean com.foxit.sdk.pdf.PDFDoc.isEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ isEncrypted()

boolean com.foxit.sdk.pdf.PDFDoc.isEncrypted | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current document is an encrypted file or not.

Returns
  true means current document is an encrypted file, while false means current document is not an encrypted file.

## ◆ isLinearized()

boolean com.foxit.sdk.pdf.PDFDoc.isLinearized | ( |  | ) | throws com.foxit.sdk.PDFException

Check if current PDF document is a linearized file.

- If current document object is constructed with an com.foxit.sdk.common.file.AsyncReaderCallback object, this function can be used before or after the document is loaded successfully. Specially, if this function is called before document is loaded successfully, application should ensure the first 1024 bytes of the PDF file is available; otherwise, this function will call the callback function common.file.AsyncReaderCallback.addDownloadHint to notify application the range of data which should be downloaded by application then, and then this function will throw exception com.foxit.sdk.common.Constants.e_ErrDataNotReady .
- If current document object is constructed from other methods or with a common com.foxit.sdk.common.fxcrt.FileReaderCallback object, this function can only be used after the document is loaded successfully; otherwise, exception com.foxit.sdk.common.Constants.e_ErrUnknownState will be thrown.

Returns
  true means current PDF document is a linearized file, and false means current PDF document is not a linearized file.

## ◆ isOwnerPassword() [1/2]

boolean com.foxit.sdk.pdf.PDFDoc.isOwnerPassword | ( | byte[] | password | ) | throws com.foxit.sdk.PDFException

Check if input password is the owner password of current PDF document.

Parameters

  [in] | password | A password string to be detected.

Returns
  true means input password is the owner password of current PDF document, while false means input password is not the owner password of current PDF document.

## ◆ isOwnerPassword() [2/2]

boolean com.foxit.sdk.pdf.PDFDoc.isOwnerPassword | ( | String | password | ) | throws com.foxit.sdk.PDFException

Check if input password is the owner password of current PDF document.

Parameters

  [in] | password | A password string to be detected.

Returns
  true means input password is the owner password of current PDF document, while false means input password is not the owner password of current PDF document.

## ◆ isPortfolio()

boolean com.foxit.sdk.pdf.PDFDoc.isPortfolio | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current PDF document is a portfolio file or not.

Returns
  true means current PDF document is a portfolio file, while false means not.

## ◆ isTaggedPDF()

boolean com.foxit.sdk.pdf.PDFDoc.isTaggedPDF | ( |  | ) | throws com.foxit.sdk.PDFException

Check if current PDF document is a Tagged PDF file.

A Tagged PDF means there is structure tree in the PDF document.

Returns
  true means current PDF document is a Tagged PDF file, and false means current PDF document is not a Tagged PDF file.

## ◆ isUserPassword() [1/2]

boolean com.foxit.sdk.pdf.PDFDoc.isUserPassword | ( | byte[] | password | ) | throws com.foxit.sdk.PDFException

Check if input password is the user password of current PDF document.

Parameters

  [in] | password | A password string to be detected.

Returns
  true means input password is the user password of current PDF document, while false means input password is not the user password of current PDF document.

## ◆ isUserPassword() [2/2]

boolean com.foxit.sdk.pdf.PDFDoc.isUserPassword | ( | String | password | ) | throws com.foxit.sdk.PDFException

Check if input password is the user password of current PDF document.

Parameters

  [in] | password | A password string to be detected.

Returns
  true means input password is the user password of current PDF document, while false means input password is not the user password of current PDF document.

## ◆ isWrapper()

boolean com.foxit.sdk.pdf.PDFDoc.isWrapper | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current document is a wrapper file or not.

Returns
  true means current document is a wrapper file, while false means current document is not a wrapper file.

## ◆ isXFA()

boolean com.foxit.sdk.pdf.PDFDoc.isXFA | ( |  | ) | throws com.foxit.sdk.PDFException

Check whether current PDF document is an XFA document.

Currently, Foxit PDF SDK does not fully support XFA document. When loading an XFA document, Foxit PDF SDK may only load the XFA wrapper level, and cannot have access to the real XFA content. Foxit PDF SDK does not support to insert/import/remove/move pages in an XFA document yet.

Returns
  true means current document is an XFA document, while false means current document is not an XFA document.

## ◆ load()

int com.foxit.sdk.pdf.PDFDoc.load | ( | byte[] | password | ) | throws com.foxit.sdk.PDFException

Load current document content by using a specified password.

If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may return com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Parameters

  [in] | password | The password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.

Returns
  com.foxit.sdk.common.Constants.e_ErrSuccess means success.
  com.foxit.sdk.common.Constants.e_ErrFile means there is any error occurs when accessing current document.
  com.foxit.sdk.common.Constants.e_ErrPassword means input password is wrong.
  com.foxit.sdk.common.Constants.e_ErrFormat means the format of current document content is not PDF or the file has been corrupted.
  com.foxit.sdk.common.Constants.e_ErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
  com.foxit.sdk.common.Constants.e_ErrCertificate means current PDF document is encrypted by digital certificate and current user does not have the correct certificate.
  For other error code value, please refer to values starting from com.foxit.sdk.common.Constants.e_ErrSuccess for more details.

## ◆ loadW()

int com.foxit.sdk.pdf.PDFDoc.loadW | ( | String | password | ) | throws com.foxit.sdk.PDFException

Load current document content by using a specified password.

If current PDF document object is constructed with an AsyncReaderCallback which means to do asynchronous loading, this function may return com.foxit.sdk.common.Constants.e_ErrDataNotReady . In this case, user should prepare data for specified range informed by callback function common.file.AsyncReaderCallback.addDownloadHint and then call this function again.

Parameters

  [in] | password | The password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.

Returns
  com.foxit.sdk.common.Constants.e_ErrSuccess means success.
  com.foxit.sdk.common.Constants.e_ErrFile means there is any error occurs when accessing current document.
  com.foxit.sdk.common.Constants.e_ErrPassword means input password is wrong.
  com.foxit.sdk.common.Constants.e_ErrFormat means the format of current document content is not PDF or the file has been corrupted.
  com.foxit.sdk.common.Constants.e_ErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
  com.foxit.sdk.common.Constants.e_ErrCertificate means current PDF document is encrypted by digital certificate and current user does not have the correct certificate.
  For other error code value, please refer to values starting from com.foxit.sdk.common.Constants.e_ErrSuccess for more details.

## ◆ movePagesTo()

boolean com.foxit.sdk.pdf.PDFDoc.movePagesTo | ( | Range | page_range,
|  | int | dest_index
| ) |  | throws com.foxit.sdk.PDFException

Move one or more pages (specified by index) to a new position.

If move only one page, this function just has the same feature as function PDFDoc.movePageTo .
If move more than one page, these page will keep the order defined in parameter page_range and be moved as a whole to after the destination index position, based on current page array.
After this function is successful, indexes of moved pages will be changed and indexes of the rest pages may be affected as well. For examples,

- Original page order: [0, 1, 2, 3, 4, 5]
- Pages to move: [0, 1]
- Destination index: 4 (move after index 4)
- Resulting order: [2, 3, 4, 0, 1, 5].

Parameters

  [in] | page_range | A range object which should at least contain one valid range. All the related pages will keep the order (specified by this range) and be moved as a whole. If there exist duplicated indexes in the range, only the last occurrence will be useful.
  [in] | dest_index | Index of the destination position, based on current page array. The pages will be moved as a whole to after the destination index position. If to move pages to the beginning of the document, set the destination index to any negative value, such as -1. If to move pages to the end of the document, set the destination index which is bigger than the last page index.

Returns
  true means success or no need to move current page, while false means failure.

## ◆ movePageTo()

boolean com.foxit.sdk.pdf.PDFDoc.movePageTo | ( | PDFPage | page,
|  | int | dest_index
| ) |  | throws com.foxit.sdk.PDFException

Move a specified page to a new position.

The page will be moved to after the destination index position. If the specified page is successfully moved to the new position, page index of all the pages between the new index and old index of the specified page will be changed as well. For examples,

- Original page order: [0, 1, 2, 3, 4, 5]
- Pages to move: [0]
- Destination index: 4 (move after index 4)
- Resulting order: [1, 2, 3, 4, 0, 5].

Parameters

  [in] | page | A PDF page to be moved. It should be in current PDF document.
  [in] | dest_index | Index of the destination position in current page array. The page will be moved to after the destination index position. count is returned by function PDFDoc.getPageCount . If to move pages to the beginning of the document, set the destination index to any negative value, such as -1. If to move pages to the end of the document, set the destination index which is bigger than the last page index. If parameter dest_index is just the same as the page index of parameter page, no change will be done and this function will return true directly.

Returns
  true means success or no need to move current page, while false means failure.

## ◆ removeAllHeaderFooters()

boolean com.foxit.sdk.pdf.PDFDoc.removeAllHeaderFooters | ( |  | ) | throws com.foxit.sdk.PDFException

Remove all header-footers.

Returns
  true means success, while false means failure.

## ◆ removeBookmark()

boolean com.foxit.sdk.pdf.PDFDoc.removeBookmark | ( | Bookmark | bookmark | ) | throws com.foxit.sdk.PDFException

Remove a specified bookmark.

Parameters

  [in] | bookmark | The valid bookmark that would be deleted.

Returns
  true means success, while false means failure.

## ◆ removeHiddenInfo()

void com.foxit.sdk.pdf.PDFDoc.removeHiddenInfo | ( | HiddenInfoSettingData | hidden_data_setting | ) | throws com.foxit.sdk.PDFException

Removes specified types of hidden information from the current PDF document based on user-defined settings.

This method provides fine-grained control over the sanitization process. Only the data types enabled in the provided settings object will be removed. It allows selective removal of elements such as metadata, bookmarks, hidden text, layers, comments, links, and more.

Parameters

  [in] | hidden_data_setting | A HiddenInfoSettingData object that defines which types of hidden data to remove.

Returns
  None.

## ◆ removeOpenAction()

boolean com.foxit.sdk.pdf.PDFDoc.removeOpenAction | ( |  | ) | throws com.foxit.sdk.PDFException

Remove the action to be performed when the document is opened.

Returns
  true means success, while false means failure.

## ◆ removePage() [1/2]

boolean com.foxit.sdk.pdf.PDFDoc.removePage | ( | int | index | ) | throws com.foxit.sdk.PDFException

Remove a PDF page by page index.

Parameters

  [in] | index | The page index. Valid range: from 0 to (count-1). count is returned by function PDFDoc.getPageCount .

Returns
  true means success, while false means failure.

## ◆ removePage() [2/2]

boolean com.foxit.sdk.pdf.PDFDoc.removePage | ( | PDFPage | page | ) | throws com.foxit.sdk.PDFException

Remove a specified PDF page.

Once the specified PDF page is removed successfully, the page object cannot be used any more.

Parameters

  [in] | page | A PDF page object that represents the PDF page to be removed. The page should be in current PDF document.

Returns
  true means success, while false means failure.

## ◆ removeReadingBookmark()

boolean com.foxit.sdk.pdf.PDFDoc.removeReadingBookmark | ( | ReadingBookmark | reading_bookmark | ) | throws com.foxit.sdk.PDFException

Remove a reading bookmark from current PDF document.

Parameters

  [in] | reading_bookmark | A valid reading bookmark to be removed.

Returns
  true means success, while false means failure.

## ◆ removeSecurity()

boolean com.foxit.sdk.pdf.PDFDoc.removeSecurity | ( |  | ) | throws com.foxit.sdk.PDFException

Remove the security handler from current document, so that the later saved document will be unencrypted.

Returns
  true means success, while false means failure.

Note
  If module "RMS" is not defined in the license information which is used in function common.Library.initialize , that means user has no right in using RMS related functions and this function will throw exception com.foxit.sdk.common.Constants.e_ErrNoRMSModuleRight .

## ◆ removeSignature()

void com.foxit.sdk.pdf.PDFDoc.removeSignature | ( | Signature | signature | ) | throws com.foxit.sdk.PDFException

Remove a signature.

Parameters

  [in] | signature | A valid signature to be removed. If this signature's type is com.foxit.sdk.pdf.Signature.e_SignatureTypePagingSeal , this function will remove all signatures related to this signature.

Returns
  None.

## ◆ removeStructTree()

void com.foxit.sdk.pdf.PDFDoc.removeStructTree | ( |  | ) |

Remove structure tree from current PDF document.

Returns
  None.

## ◆ sanitize()

void com.foxit.sdk.pdf.PDFDoc.sanitize | ( |  | ) | throws com.foxit.sdk.PDFException

Removes all hidden or potentially sensitive information from the current PDF document using default settings.

This method performs a full sanitization of the PDF document. It automatically detects and removes metadata, comments, hidden text, file attachments, annotations, and other elements that may contain hidden or private information.

Returns
  None.

## ◆ saveAs()

boolean com.foxit.sdk.pdf.PDFDoc.saveAs | ( | String | file_path,
|  | int | save_flags
| ) |  | throws com.foxit.sdk.PDFException

Save current PDF document as another PDF file.

If current document is loaded from an existing PDF file and a different file version has been set by PDFDoc.setFileVersion before saving, Foxit PDF SDK will ignore com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters

  [in] | file_path | A full path for the new saved PDF file. It should not be an empty string.
  [in] | save_flags | Document saving flags. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal and this can be one or combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal .

Returns
  true means the saving is successfully finished, while false means failure.

Note
  This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
  Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the saved PDF file to do other operation.

## ◆ saveAsWrapperFile()

boolean com.foxit.sdk.pdf.PDFDoc.saveAsWrapperFile | ( | String | file_path,
|  | WrapperData | wrapper_data,
|  | int | user_permissions,
|  | String | owner_password
| ) |  | throws com.foxit.sdk.PDFException

Save current PDF document as a wrapper file.

PDF wrapper is an extended standard, and it helps to hint some information to viewers.
PDF wrapper consists of

- wrapper type: it is an identity string,
- wrapper offset: it tells the end of original data,
- wrapper template: it is the content of wrapper document.

This function uses the current size of file which is specified by file_path to set wrapper offset.

Parameters

  [in] | file_path | A full path of a PDF file. Current PDF document will be saved into this PDF file as a wrapper file.
  [in] | wrapper_data | Wrapper data. If this is null, no wrapper data is used. Default value: null.
  [in] | user_permissions | User permissions for the wrapper document. Pass 0xFFFFFFFC if no special permissions is needed. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_PermPrint and this should be one or combination of these values. Default value: 0xFFFFFFFC.
  [in] | owner_password | Owner password. If this is an empty string, parameter user_permissions will be ignored. Default value: an empty string.

Returns
  true means success, while false means failure.

## ◆ setCacheFile()

void com.foxit.sdk.pdf.PDFDoc.setCacheFile | ( | StreamCallback | file_stream,
|  | boolean | is_own_file_stream
| ) |  | throws com.foxit.sdk.PDFException

Set cache file (represented by a file stream) to current PDF document.

Cache file can be used to cache the large amount of data which are generated when the content stream is generated.

Parameters

  [in] | file_stream | A com.foxit.sdk.common.fxcrt.StreamCallback object which is implemented by user to cache data. It can be null. The origin cache file will be released if it is null.
  [in] | is_own_file_stream | Used to decide whether Foxit PDF SDK should own input stream callback object or not: true means input stream callback object will be destroyed by Foxit PDF SDK (by calling callback function com.foxit.sdk.common.fxcrt.StreamCallback.release ) when no need to cache data anymore for current PDF document. false means user should be responsible to destroy the stream callback object when no need to modify any content of current PDF document.

Returns
  None.

## ◆ setDisplayMode()

void com.foxit.sdk.pdf.PDFDoc.setDisplayMode | ( | int | display_mode | ) | throws com.foxit.sdk.PDFException

Set the display mode.

Display mode specifies how the document should be displayed when opened.

Parameters

  [in] | display_mode | Display mode value. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_DisplayUseNone and this should be one of these values.

Returns
  None.

## ◆ setFileVersion()

void com.foxit.sdk.pdf.PDFDoc.setFileVersion | ( | int | version | ) | throws com.foxit.sdk.PDFException

Set the PDF file version which will be stored in PDF header section of the saved PDF file.

The new file version will not affect on current document directly, but will be used in the saved PDF file in function pdf.PDFDoc.saveAs or PDFDoc.startSaveAs . This function does not check whether the PDF content matches the specified version.
If user wants to do compliance conversion about PDF version, please refer to module "Compliance" and use class com.foxit.sdk.addon.compliance.PDFCompliance .

Parameters

  [in] | version | An integer that specifies the file version, for example value 14 means version "1.4", value 15 means "1.5", and etc. This value should be from 10 to 17 or 20 and be equal or greater than current version of current PDF file.

Returns
  None.

## ◆ setOpenAction()

boolean com.foxit.sdk.pdf.PDFDoc.setOpenAction | ( | Action | action | ) | throws com.foxit.sdk.PDFException

Set the action to be performed when the document is opened.

Parameters

  [in] | action | A valid action to be set. Currently only support following types as the new action: com.foxit.sdk.pdf.actions.Action.e_TypeGoto , com.foxit.sdk.pdf.actions.Action.e_TypeURI , com.foxit.sdk.pdf.actions.Action.e_TypeJavaScript , com.foxit.sdk.pdf.actions.Action.e_TypeNamed , com.foxit.sdk.pdf.actions.Action.e_TypeSubmitForm , com.foxit.sdk.pdf.actions.Action.e_TypeResetForm , com.foxit.sdk.pdf.actions.Action.e_TypeHide , com.foxit.sdk.pdf.actions.Action.e_TypeImportData .

Returns
  true means success, while false means failure.

## ◆ setSecurityHandler()

boolean com.foxit.sdk.pdf.PDFDoc.setSecurityHandler | ( | SecurityHandler | handler | ) | throws com.foxit.sdk.PDFException

Set a PDF security handler for encryption, such as standard encryption(password), certificate encryption, and so on.

Parameters

  [in] | handler | A PDF security handler object.

Returns
  true means success, while false means failure.

Note
  If module "RMS" is not defined in the license information which is used in function common.Library.initialize , that means user has no right in using RMS related functions and this function will throw exception com.foxit.sdk.common.Constants.e_ErrNoRMSModuleRight .

## ◆ startAddTiledWatermark() [1/4]

Progressive com.foxit.sdk.pdf.PDFDoc.startAddTiledWatermark | ( | FileReaderCallback | src_img_stream,
|  | TiledWatermarkSettings | settings,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Add image type tiled watermark to PDF pages by image stream.

If the watermark is tiled to multiple pages, these pages will keep the order defined in the parameter page_range. If the parameter page_range is initialized to empty, the watermark will be tiled to all pages of the document by default. In addition, XFA dynamic documents don't support inserting tiled watermark.
Image tiled watermarks support .bmp .dib .jpg .jpeg .jpe .gif .png .tif .tiff format.

Parameters

  [in] | src_img_stream | A com.foxit.sdk.common.fxcrt.FileReaderCallback object which is image stream by user to pass image data to Foxit PDF SDK. It must be vaild.
  [in] | settings | Tiled watermark settings, containing layout setting.
  [in] | page_range | A range object that specifies some pages. These pages will be added tiled watermarks. The valid page range: from 0 to (count -1). count is returned by function PDFDoc.getPageCount . If this range object is constructed by default constructor and not set any value, that means all the pages of current document will be added tiled watermarks.
  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startAddTiledWatermark() [2/4]

Progressive com.foxit.sdk.pdf.PDFDoc.startAddTiledWatermark | ( | PDFPage | page,
|  | TiledWatermarkSettings | settings,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Add page type tiled watermark to PDF pages.

If the watermark is tiled to multiple pages, these pages will keep the order defined in the parameter page_range. If the parameter page_range is initialized to empty, the watermark will be tiled to all pages of the document by default. In addition, XFA dynamic documents don't support inserting tiled watermarks.

Parameters

  [in] | page | A valid PDF page object, whose content will be used as the content of the tiled watermark.
  [in] | settings | Tiled watermark settings, containing layout setting.
  [in] | page_range | A range object that specifies some pages. These pages will be added tiled watermarks. The valid page range: from 0 to (count -1). count is returned by function PDFDoc.getPageCount . If this range object is constructed by default constructor and not set any value, that means all the pages of current document will be added tiled watermarks.
  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startAddTiledWatermark() [3/4]

Progressive com.foxit.sdk.pdf.PDFDoc.startAddTiledWatermark | ( | String | src_img_file_path,
|  | TiledWatermarkSettings | settings,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Add image type tiled watermark to PDF pages by image path.

If the watermark is tiled to multiple pages, these pages will keep the order defined in the parameter page_range. If the parameter page_range is initialized to empty, the watermark will be tiled to all pages of the document by default. In addition, XFA dynamic documents don't support inserting tiled watermarks.
Image tiled watermarks support .bmp .dib .jpg .jpeg .jpe .gif .png .tif .tiff format.

Parameters

  [in] | src_img_file_path | Path of a image file. This should not be an empty string.
  [in] | settings | Tiled watermark settings, containing layout setting.
  [in] | page_range | A range object that specifies some pages. These pages will be added tiled watermarks. The valid page range: from 0 to (count -1). count is returned by function PDFDoc.getPageCount . If this range object is constructed by default constructor and not set any value, that means all the pages of current document will be added tiled watermarks.
  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startAddTiledWatermark() [4/4]

Progressive com.foxit.sdk.pdf.PDFDoc.startAddTiledWatermark | ( | String | text,
|  | TiledWatermarkSettings | settings,
|  | WatermarkTextProperties | properties,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Add text type tiled watermark to PDF pages.

If the watermark is tiled to multiple pages, these pages will keep the order defined in the parameter page_range. If the parameter page_range is initialized to empty, the watermark will be tiled to all pages of the document by default. In addition, XFA dynamic documents don't support inserting tiled watermarks.

Parameters

  [in] | text | A text string. This will be used as the content of the tiled watermark, It should not be an empty string.
  [in] | settings | Tiled watermark settings, containing layout setting.
  [in] | properties | Text properties for tiled watermark.
  [in] | page_range | A range object that specifies some pages. These pages will be added tiled watermarks. The valid page range: from 0 to (count -1). count is returned by function PDFDoc.getPageCount . If this range object is constructed by default constructor and not set any value, that means all the pages of current document will be added tiled watermarks.
  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startEmbedAllFonts()

Progressive com.foxit.sdk.pdf.PDFDoc.startEmbedAllFonts | ( | PauseCallback | pause | ) | throws com.foxit.sdk.PDFException

Start to convert all un-embeded fonts to embeded fonts.

It may take a long time to convert all un-embedded fonts to embedded fonts in current PDF document, so this function uses a progressive process to do this.
This function only works with fonts available for embedding. Whether a font is embeddable or not can be checked by function common.Font.isSupportEmbedded .
This function will delete the original font object after embedding the font, however, the reference to the original font in the document will still exist.

Parameters

  [in] | pause | Pause callback object which decides if the embedding process needs to be paused. This can be null which means not to pause during the embedding process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startExtractPages() [1/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startExtractPages | ( | FileWriterCallback | file,
|  | int | options,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to extract pages from current PDF document.

It may take a long time to extracting pages, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | file | A com.foxit.sdk.common.fxcrt.FileWriterCallback object which is implemented by user to store the data of all the extracted pages in custom method.
  [in] | options | Options for extracting pages. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_ExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
  [in] | page_range | A range object to specify which pages are to be extracted. If this range object is constructed by default constructor and not set any value, all pages in the current document will be extracted. Default value: a range object by default constructor and not set any value.
  [in] | pause | Pause object which decides if the extracting process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startExtractPages() [2/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startExtractPages | ( | String | file_path,
|  | int | options,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to extract pages from current PDF document.

It may take a long time to extracting pages, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | file_path | A full path for the new saved PDF file which is used to save the extracted pages. It should not be an empty string.
  [in] | options | Options for extracting pages. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_ExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
  [in] | page_range | A range object to specify which pages are to be extracted. If this range object is constructed by default constructor and not set any value, all pages in the current document will be extracted. Default value: a range object by default constructor and not set any value.
  [in] | pause | Pause object which decides if the extracting process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startGetPayloadFile()

Progressive com.foxit.sdk.pdf.PDFDoc.startGetPayloadFile | ( | FileWriterCallback | payload_file,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to get payload file.

It may take a long time to getting payload document, so this function uses a progressive process to do this.

Parameters

  [in] | payload_file | A WriterCallback callback object. User should implement the callback function in this callback object in order that this callback object can be used to save payload file.
  [in] | pause | Pause callback object which decides if the parsing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startImportPages()

Progressive com.foxit.sdk.pdf.PDFDoc.startImportPages | ( | int | dest_index,
|  | PDFDoc | src_doc,
|  | int | flags,
|  | String | layer_name,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to import pages from another PDF document (via PDF document object).

It may take a long time to importing pages, so Foxit PDF SDK uses a progressive process to do this.
Signed signatures in the pages of source PDF document will not be imported into current PDF document.
Currently, if either current PDF document or the source PDF document contains XFA, not support to do the importing.
If this function is used to combine two PDF files, pages are strongly recommended to be imported to the end of destination PDF file instead of to the beginning of destination PDF file.

Parameters

  [in] | dest_index | A page index in current PDF document. This is used to specify where the imported pages will be inserted: If parameter dest_index is less than 0, the imported pages will be inserted to the first. If parameter dest_index is equal to or larger than current page count, the imported pages will be inserted to the end.
  [in] | src_doc | A PDF document object which is the source PDF document. Pages in this document will be imported to current PDF document. Please keep this source PDF document object valid until current document will not be saved any more or is closed.
  [in] | flags | Options for importing pages. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_ImportFlagNormal and this can be one or a combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_ImportFlagNormal .
  [in] | layer_name | The name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application. Default value: an empty string. If parameter flags contains com.foxit.sdk.pdf.PDFDoc.e_ImportFlagWithLayers , this should not be empty and should be a valid string. If parameter flags does not contain com.foxit.sdk.pdf.PDFDoc.e_ImportFlagWithLayers , this string will be ignored. If all the pages of source PDF document is to be imported to current document, all layers from source document will be grouped under a non- selectable label, and this string will be directly used as the label. If only part of pages of source PDF document is to be imported to current document, layers in the same page will be grouped under a single non- selectable label, and this string will be used as the prefix name of the label. The label will be like "layerName_Page_X".
  [in] | page_range | A range object to specify which pages is to be inserted. If this range object is constructed by default constructor and not set any value, all pages in the source document will be imported. Default value: a range object by default constructor and not set any value.
  [in] | pause | Pause object which decides if the importing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startImportPagesFromFilePath()

Progressive com.foxit.sdk.pdf.PDFDoc.startImportPagesFromFilePath | ( | int | dest_index,
|  | String | src_file_path,
|  | byte[] | password,
|  | int | flags,
|  | String | layer_name,
|  | Range | page_range,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to import pages from another PDF document (via file path).

It may take a long time to importing pages, so Foxit PDF SDK uses a progressive process to do this.
Signed signatures in the pages of source PDF document will not be imported into current PDF document.
Currently, Foxit PDF SDK does not support to do the importing if either current PDF document or the source PDF document contains XFA.
If this function is used to combine two PDF files, pages are strongly recommended to be imported to the end of destination PDF file instead of to the beginning of destination PDF file.

Parameters

  [in] | dest_index | A page index in current PDF document. This is used to specify where the imported pages will be inserted. If parameter dest_index is less than 0, the imported pages will be inserted to the first. If parameter dest_index is equal to or larger than current page count, the imported pages will be inserted to the end.
  [in] | src_file_path | A full path of an existing PDF file as the source PDF document. Some pages will be imported from this PDF file to current PDF document.
  [in] | password | A password string used to load source PDF document content. The password can be either user password or owner password. If source PDF document is not encrypted by password, just pass an empty string.
  [in] | flags | Options for importing pages. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_ImportFlagNormal and this can be one or a combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_ImportFlagNormal .
  [in] | layer_name | The name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application. Default value: an empty string. If parameter flags contains com.foxit.sdk.pdf.PDFDoc.e_ImportFlagWithLayers , this should not be empty and should be a valid string. If parameter flags does not contain com.foxit.sdk.pdf.PDFDoc.e_ImportFlagWithLayers , this string will be ignored. If all the pages of source PDF document is to be imported to current document, all layers from source document will be grouped under a non- selectable label, and this string will be directly used as the label. If only part of pages of source PDF document is to be imported to current document, layers in the same page will be grouped under a single non-selectable label, and this string will be used as the prefix name of the label. The label will be like "layerName_Page_X".
  [in] | page_range | A range object to specify which pages is to be imported. If this range object is constructed by default constructor and not set any value, all pages in the source document will be imported. Default value: a range object by default constructor and not set any value.
  [in] | pause | Pause object which decides if the importing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startLoad()

Progressive com.foxit.sdk.pdf.PDFDoc.startLoad | ( | byte[] | password,
|  | boolean | is_cache_stream,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to loading current document content by using a specified password.

It may take a long time to loading document content, so this function uses a progressive process to do this.
When using this function, parameter is_cache_stream can be used to decide whether to load stream content into memory or not:

- Loading stream content into memory will improve performance for frequent access, however, it will also consume a lot of memory space.
- Not to load stream content into memory, that means to leave stream content on file system, and read them when needed. This may reduce the performance a little bit, but greatly reduce the memory consumption, especially when the file is big.

Parameters

  [in] | password | A password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
  [in] | is_cache_stream | true means to load stream content into memory, and false means not to load stream content into memory and just leave stream content on file system and read them when needed. Please refer to "Details" part about the difference between these two modes. Default value: true.
  [in] | pause | Pause object which decides if the loading process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startLoadW()

Progressive com.foxit.sdk.pdf.PDFDoc.startLoadW | ( | String | password,
|  | boolean | is_cache_stream,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to loading current document content by using a specified password.

It may take a long time to loading document content, so this function uses a progressive process to do this.
When using this function, parameter is_cache_stream can be used to decide whether to load stream content into memory or not:

- Loading stream content into memory will improve performance for frequent access, however, it will also consume a lot of memory space.
- Not to load stream content into memory, that means to leave stream content on file system, and read them when needed. This may reduce the performance a little bit, but greatly reduce the memory consumption, especially when the file is big.

Parameters

  [in] | password | A password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
  [in] | is_cache_stream | true means to load stream content into memory, and false means not to load stream content into memory and just leave stream content on file system and read them when needed. Please refer to "Details" part about the difference between these two modes. Default value: true.
  [in] | pause | Pause object which decides if the loading process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startRecognizeForm() [1/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startRecognizeForm | ( | boolean | is_set_tool_tips,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to recognize form in current PDF document.

It may take a long time to recognize form in PDF document, so this function uses a progressive process to do this.
For windows platform, users are strongly recommended to initialize OCR engine by calling function addon::ocr::OCREngine::Initialize before calling this function.

Parameters

  [in] | is_set_tool_tips | true means to set tool tips for recognized form field, while false means not to set tool tips for recognized form field.
  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startRecognizeForm() [2/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startRecognizeForm | ( | PauseCallback | pause | ) | throws com.foxit.sdk.PDFException

Start to recognize form in current PDF document.

It may take a long time to recognize form in PDF document, so this function uses a progressive process to do this.
For windows platform, users are strongly recommended to initialize OCR engine by calling function addon::ocr::OCREngine::Initialize before calling this function.

Parameters

  [in] | pause | Pause callback object which decides if the recognizing process needs to be paused. This can be null which means not to pause during the recognizing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ startSaveAs() [1/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startSaveAs | ( | FileWriterCallback | file,
|  | int | save_flags,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to save current PDF document as another PDF file.

It may take a long time to saving PDF document, so this function uses a progressive process to do this.
If current document is loaded from an existing PDF file and a different file version has been set by PDFDoc.setFileVersion before saving, Foxit PDF SDK will ignore com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters

  [in] | file | A com.foxit.sdk.common.fxcrt.FileWriterCallback object which is implemented by user to save a PDF document.
  [in] | save_flags | Document saving flags. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal and this can be one or combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal .
  [in] | pause | Pause callback object which decides if the parsing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
  Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the saved PDF file to do other operation.

## ◆ startSaveAs() [2/2]

Progressive com.foxit.sdk.pdf.PDFDoc.startSaveAs | ( | String | file_path,
|  | int | save_flags,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to save current PDF document as another PDF file.

It may take a long time to saving PDF document, so this function uses a progressive process to do this.
If current document is loaded from an existing PDF file and a different file version has been set by PDFDoc.setFileVersion before saving, Foxit PDF SDK will ignore com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters

  [in] | file_path | A full path for the new saved PDF file. It should not be an empty string.
  [in] | save_flags | Document saving flags. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal and this can be one or combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal .
  [in] | pause | Pause callback object which decides if the parsing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

Note
  This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
  Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the saved PDF file to do other operation.

## ◆ startSaveAsPayloadFile()

Progressive com.foxit.sdk.pdf.PDFDoc.startSaveAsPayloadFile | ( | String | file_path,
|  | String | payload_file_path,
|  | String | crypto_filter,
|  | String | description,
|  | float | version,
|  | int | save_flags,
|  | PauseCallback | pause
| ) |  | throws com.foxit.sdk.PDFException

Start to save current PDF document as a wrapper document with a payload document (defined in PDF 2.0).

It may take a long time to saving PDF document, so this function uses a progressive process to do this.
If current document is loaded from an existing PDF file and a different file version has been set by PDFDoc.setFileVersion before saving, Foxit PDF SDK will ignore com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters

  [in] | file_path | A full path for the new saved PDF file. It should not be an empty string.
  [in] | payload_file_path | A full path of a PDF document which will be used as payload document. It should not be an empty string.
  [in] | crypto_filter | The name of the cryptographic filter used to encrypt the encrypted payload document.
  [in] | description | Description for wrapper file to show applications or confront users prompt information.
  [in] | version | The version number of the cryptographic filter used to encrypt the encrypted payload referenced by this dictionary.
  [in] | save_flags | Document saving flags. Please refer to values starting from com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal and this can be one or combination of these values. Default value: com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal .
  [in] | pause | Pause callback object which decides if the parsing process needs to be paused. This can be null which means not to pause during the parsing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function common.Progressive.getRateOfProgress . If the rate is not 100 yet, call function common.Progressive.resume to continue the progress until the progress is finished.

## ◆ updateHeaderFooter()

void com.foxit.sdk.pdf.PDFDoc.updateHeaderFooter | ( | HeaderFooter | headerfooter | ) | throws com.foxit.sdk.PDFException

Update header-footer.

A PDF document can be added header-footer sereral times. When a header-footer is updated to the document, the old ones which appear in the same place with the new one will all be removed and then the new one will be added.

Parameters

  [in] | headerfooter | A valid header-footer object to be updated to current document.

Returns
  None.

## Member Data Documentation

## ◆ e_ImportFlagShareStream

final int com.foxit.sdk.pdf.PDFDoc.e_ImportFlagShareStream = 0x0002
| static

Import pages without cloning stream objects into memory.

This flags is only useful when the source PDF document has not been encrypted. If this flag is used for importing pages, it will reduce memory overhead.

## ◆ e_PermAnnotForm

final int com.foxit.sdk.pdf.PDFDoc.e_PermAnnotForm = 0x0020
| static

Operate text annotations and fill in interactive form fields. (Bit 6 in permission value)

If value com.foxit.sdk.pdf.PDFDoc.e_PermModify is also set, user can create or modify interactive form fields (including signature fields).

## ◆ e_PermAssemble

final int com.foxit.sdk.pdf.PDFDoc.e_PermAssemble = 0x0400
| static

Assemble PDF document. (Bit 11 in permission value)

If this value is set, it enables to assemble the document (Insert, rotate, or delete pages and create bookmarks or thumbnail images), regardless if value com.foxit.sdk.pdf.PDFDoc.e_PermModify is set or not.

## ◆ e_PermExtract

final int com.foxit.sdk.pdf.PDFDoc.e_PermExtract = 0x0010
| static

Extract PDF contents. (Bit 5 in permission value)

If this value is set, user can copy or otherwise extract text and graphics from the document by operations other than that controlled by value com.foxit.sdk.pdf.PDFDoc.e_PermExtractAccess .

## ◆ e_PermExtractAccess

final int com.foxit.sdk.pdf.PDFDoc.e_PermExtractAccess = 0x0200
| static

Disabilities support. (Bit 10 in permission value)

If this value is set, user can extract text and graphics in support of accessibility to users with disabilities or for other purposes.

## ◆ e_PermFillForm

final int com.foxit.sdk.pdf.PDFDoc.e_PermFillForm = 0x0100
| static

Fill PDF form. (Bit 9 in permission value)

If this value is set, user can fill in interactive form fields (including signature fields), even if value com.foxit.sdk.pdf.PDFDoc.e_PermAnnotForm is not used.

## ◆ e_PermModify

final int com.foxit.sdk.pdf.PDFDoc.e_PermModify = 0x0008
| static

Modify PDF contents. (Bit 4 in permission value)

If this value is set, user can modify contents of PDF document by operations other than those controlled by values com.foxit.sdk.pdf.PDFDoc.e_PermAnnotForm , com.foxit.sdk.pdf.PDFDoc.e_PermFillForm and com.foxit.sdk.pdf.PDFDoc.e_PermAssemble .

## ◆ e_PermPrint

final int com.foxit.sdk.pdf.PDFDoc.e_PermPrint = 0x0004
| static

Print PDF document with normal mode. (Bit 3 in permission value)

If user wants to print a higher quality level of PDF document, please set current value with value com.foxit.sdk.pdf.PDFDoc.e_PermPrintHigh together.

## ◆ e_PermPrintHigh

final int com.foxit.sdk.pdf.PDFDoc.e_PermPrintHigh = 0x0800
| static

Print PDF document with higher qualities. (Bit 12 in permission value)

If this value is not set (and value com.foxit.sdk.pdf.PDFDoc.e_PermPrint is set), printing is limited to a low-level representation of the appearance, possibly of degraded quality.

## ◆ e_SaveFlagIncremental

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental = 0x0001
| static

Save document incrementally.

This can be used alone or be combined with other saving flags except com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal . Especially, if this is combined with com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoOriginal , only the increment data will be saved.

## ◆ e_SaveFlagLinearized

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagLinearized = 0x1000
| static

Save document as a linearized file.

This should be used alone and cannot be used with other saving flags except com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoUpdatingMetadataDateTime .. This can only be used for function pdf.PDFDoc.saveAs or PDFDoc.startSaveAs .

## ◆ e_SaveFlagNoOriginal

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoOriginal = 0x0002
| static

Save document without original data or unchanged objects.

This can be used alone or be combined with other saving flags except com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal . Especially, if this is combined with com.foxit.sdk.pdf.PDFDoc.e_SaveFlagIncremental , only the increment data will be saved.

## ◆ e_SaveFlagNormal

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal = 0
| static

Save document normally, without using any special flag.

This can only be combined with flag com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoUpdatingMetadataDateTime .

## ◆ e_SaveFlagNoUpdatingMetadataDateTime

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoUpdatingMetadataDateTime = 0x0020
| static

Save document without updating metadata "ModDate" and "CreationDate".

This can be used alone or be combined with other saving flags. This can only be used for function pdf.PDFDoc.saveAs and PDFDoc.startSaveAs .

## ◆ e_SaveFlagRemoveRedundantObjects

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagRemoveRedundantObjects = 0x0010
| static

Save document with removing redundant PDF objects.

This can be used alone or be combined with com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoOriginal , com.foxit.sdk.pdf.PDFDoc.e_SaveFlagXRefStream or com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNoUpdatingMetadataDateTime . This can only be used for function pdf.PDFDoc.saveAs or PDFDoc.startSaveAs .

## ◆ e_SaveFlagXRefStream

final int com.foxit.sdk.pdf.PDFDoc.e_SaveFlagXRefStream = 0x0008
| static

Save document by using XRef stream.

This can be used alone or be combined with other saving flags except com.foxit.sdk.pdf.PDFDoc.e_SaveFlagNormal .