Foxit PDF SDK
FSPDFDoc Class Reference
Inheritance diagram for FSPDFDoc:
FSBase

Instance Methods

(void) - addHeaderFooter:
 Add new header-footer.
More...
 
(unsigned int) - addIndirectObject:
 Add a PDF object to current PDF document, to be an indirect object.
More...
 
(FSPDFPage *) - addPageFromTemplate:
 Adds a new PDF page to document, from a named template.
More...
 
(FSPagingSealSignature *) - addPagingSealSignature:width:height:
 Add a paging seal signature to document by page range.
More...
 
(void) - addTableOfContents:bookmark_level_array:
 Insert page(s) as the table of contents to the front of current PDF document.
More...
 
(void) - addTableOfContentsWithTableOfContentsConfig:
 Insert page(s) as the table of contents to the front of current PDF document.
More...
 
(FSPDFDocPasswordType- checkPassword:
 Check the type of a specified password.
More...
 
(void) - clearRenderCache
 Clear the cache used during rendering, to reduce the memory usage.
More...
 
(void) - createDSS
 Create DSS information in current PDF document.
More...
 
(FSBookmark *) - createRootBookmark
 Create new bookmark root node.
More...
 
(void) - deleteIndirectObject:
 Delete an indirect object by indirect object number.
More...
 
(BOOL) - doJSOpenAction
 Perform JavaScript actions when the document is opened.
More...
 
(BOOL) - exportAnnotToFDF:fdf_doc:
 Export specified annotation to a FDF/XFDF document.
More...
 
(BOOL) - exportFormFieldsToFDF:is_include:fdf_doc:
 Export specified form fields to a FDF/XFDF document.
More...
 
(BOOL) - exportToFDF:types:page_range:
 Export form fields and annotations to a FDF/XFDF document.
More...
 
(int) - getBookmarkLevelDepth
 Get bookmark level depth.
More...
 
(FSPDFDictionary *) - getCatalog
 Get the catalog dictionary.
More...
 
(FSCertificateEncryptData *) - getCertificateEncryptData
 Get encrypt data of certificate encryption.
More...
 
(FSCustomEncryptData *) - getCustomEncryptData
 Get encrypt data of custom encryption.
More...
 
(FSDRMEncryptData *) - getDRMEncryptData
 Get encrypt data of Foxit DRM encryption.
More...
 
(FSHeaderFooter *) - getEditableHeaderFooter
 Get the editable header footer object.
More...
 
(FSEmbeddedFontData *) - getEmbeddedFontData
 Get embedded font data.
More...
 
(FSPDFDictionary *) - getEncryptDict
 Get the encrypt dictionary.
More...
 
(FSPDFDocEncryptType- getEncryptionType
 Get the encryption type.
More...
 
(unsigned long long) - getFileSize
 Get file size.
More...
 
(int) - getFirstAvailPageIndex
 Get the page index of the fist available page.
More...
 
(FSFont *) - getFont:
 Get a font by index.
More...
 
(int) - getFontCount
 Count all the PDF fonts used in current PDF document.
More...
 
(NSString *) - getHeader
 Get PDF header identifying the version of the PDF specification to which the file conforms.
More...
 
(FSPDFObject *) - getIndirectObject:
 Get an indirect object by indirect object number.
More...
 
(FSPDFDictionary *) - getInfo
 Get the information dictionary.
More...
 
(FSAction *) - getOpenAction
 Get the action to be performed when the document is opened.
More...
 
(FSPDFPage *) - getPage:
 Get a PDF page by index.
More...
 
(FSPageBasicInfo *) - getPageBasicInfo:
 Get the basic information of a page specified by index.
More...
 
(int) - getPageCount
 Get the count of pages.
More...
 
(FSPDFDictionary *) - getPagesDict
 Get the dictionary of "Pages".
More...
 
(NSString *) - getPageText:
 Get the specified PDF page text which the text is in display order.
More...
 
(FSPDFDocPasswordType- getPasswordType
 Get the type of current used password.
More...
 
(FSPayLoadData *) - getPayLoadData
 Get payload data if current document's wrapper type is FSPDFDocWrapperPDFV2.
More...
 
(FSReadingBookmark *) - getReadingBookmark:
 Get a reading bookmark by index.
More...
 
(int) - getReadingBookmarkCount
 Get the count of reading bookmarks.
More...
 
(FSRMSEncryptData *) - getRMSEncryptData
 Get encrypt data of RMS encryption.
More...
 
(FSBookmark *) - getRootBookmark
 Get bookmark root node.
More...
 
(FSSecurityHandler *) - getSecurityHandler
 Get current PDF security handler of current document.
More...
 
(FSSignature *) - getSignature:
 Get a signature by index.
More...
 
(int) - getSignatureCount
 Get the count of signature.
More...
 
(FSStdEncryptData *) - getStdEncryptData
 Get encrypt data of standard encryption (known as password encryption).
More...
 
(FSPDFDictionary *) - getTrailer
 Get the trailer dictionary.
More...
 
(NSString *) - getUserPassword:
 Get the user password based on owner password.
More...
 
(unsigned int) - getUserPermissions
 Get user access permissions.
More...
 
(FSWrapperData *) - getWrapperData
 Get wrapper data if current document's wrapper type is FSPDFDocWrapperFoxit.
More...
 
(long long) - getWrapperOffset
 Get wrapper offset if current document's wrapper type is FSPDFDocWrapperFoxit.
More...
 
(FSPDFDocWrapperType- getWrapperType
 Get Wrapper type.
More...
 
(BOOL) - hasForm
 Check whether current PDF document has interactive form (also known as AcroForm).
More...
 
(BOOL) - hasHeaderFooter
 Check whether current document has header-footer.
More...
 
(BOOL) - hasLayer
 Check whether current PDF document has layer (known as "Optional content group" in <PDF reference 1.7>) or not.
More...
 
(BOOL) - hidePageTemplate:
 Hide a named page.
More...
 
(BOOL) - importFromFDF:types:page_range:
 Import form fields and annotations from a FDF/XFDF document.
More...
 
(id) - init
 Constructor.
More...
 
(id) - initWithBuffer:
 Constructor, from a memory buffer.
More...
 
(id) - initWithFile_read:is_async:
 Constructor, with a file read callback object.
More...
 
(id) - initWithOther:
 Constructor, with another PDF document object.
More...
 
(id) - initWithPath:
 Constructor, from an existing PDF file path.
More...
 
(void) - insertDocument:src_doc:options:
 Insert another PDF document to the specified location of current PDF document.
More...
 
(FSPDFPage *) - insertPage:width:height:
 Insert a new blank PDF page to document, by index.
More...
 
(FSPDFPage *) - insertPageWithType:size:
 Insert a new blank PDF page to document, by index.
More...
 
(FSReadingBookmark *) - insertReadingBookmark:title:dest_page_index:
 Insert a reading bookmark to current PDF document.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(BOOL) - isEncrypted
 Check whether current document is an encrypted file or not.
More...
 
(BOOL) - isLinearized
 Check if current PDF document is a linearized file.
More...
 
(BOOL) - isOwnerPassword:
 Check if input password is the owner password of current PDF document.
More...
 
(BOOL) - isPortfolio
 Check whether current PDF document is a portfolio file or not.
More...
 
(BOOL) - isTaggedPDF
 Check if current PDF document is a Tagged PDF file.
More...
 
(BOOL) - isUserPassword:
 Check if input password is the user password of current PDF document.
More...
 
(BOOL) - isWrapper
 Check whether current document is a wrapper file or not.
More...
 
(BOOL) - isXFA
 Check whether current PDF document is an XFA document.
More...
 
(FSErrorCode- load:
 Load current document content by using a specified password.
More...
 
(FSErrorCode- loadW:
 Load current document content by using a specified password.
More...
 
(BOOL) - movePagesTo:dest_index:
 Move one or more pages (specified by index) to a new index position.
More...
 
(BOOL) - movePageTo:dest_index:
 Move a specified page to a new index position.
More...
 
(BOOL) - removeAllHeaderFooters
 Remove all header-footers.
More...
 
(BOOL) - removeBookmark:
 Remove a specified bookmark.
More...
 
(BOOL) - removeOpenAction
 Remove the action to be performed when the document is opened.
More...
 
(BOOL) - removePage:
 Remove a PDF page by page index.
More...
 
(BOOL) - removePageWithPDFPage:
 Remove a specified PDF page.
More...
 
(BOOL) - removeReadingBookmark:
 Remove a reading bookmark from current PDF document.
More...
 
(BOOL) - removeSecurity
 Remove the security handler from current document, so that the later saved document will be unencrypted.
More...
 
(void) - removeSignature:
 Remove a signature.
More...
 
(BOOL) - saveAs:save_flags:
 Save current PDF document as another PDF file.
More...
 
(BOOL) - saveAsWrapperFile:wrapper_data:user_permissions:owner_password:
 Save current PDF document as a wrapper file.
More...
 
(void) - setCacheFile:is_own_file_stream:
 Set cache file (represented by a file stream) to current PDF document.
More...
 
(BOOL) - setOpenAction:
 Set the action to be performed when the document is opened.
More...
 
(BOOL) - setSecurityHandler:
 Set a PDF security handler for encryption, such as standard encryption(password), certificate encryption, and so on.
More...
 
(FSProgressive *) - startExtractPages:options:page_range:pause:
 Start to extract pages from current PDF document.
More...
 
(FSProgressive *) - startExtractPagesWithWriterCallback:options:page_range:pause:
 Start to extract pages from current PDF document.
More...
 
(FSProgressive *) - startGetPayloadFile:pause:
 Start to get payload file.
More...
 
(FSProgressive *) - startImportPages:src_doc:flags:layer_name:page_range:pause:
 Start to import pages from another PDF document (via PDF document object).
More...
 
(FSProgressive *) - startImportPagesFromFilePath:src_file_path:password:flags:layer_name:page_range:pause:
 Start to import pages from another PDF document (via file path).
More...
 
(FSProgressive *) - startLoad:is_cache_stream:pause:
 Start to loading current document content by using a specified password.
More...
 
(FSProgressive *) - startLoadW:is_cache_stream:pause:
 Start to loading current document content by using a specified password.
More...
 
(FSProgressive *) - startRecognizeForm:
 Start to recognize form in current PDF document.
More...
 
(FSProgressive *) - startSaveAs:save_flags:pause:
 Start to save current PDF document as another PDF file.
More...
 
(FSProgressive *) - startSaveAsPayloadFile:payload_file_path:crypto_filter:description:version:save_flags:pause:
 Start to save current PDF document as a wrapper document with a payload document (defined in PDF 2.0).
More...
 
(FSProgressive *) - startSaveAsWithWriterCallback:save_flags:pause:
 Start to save current PDF document as another PDF file.
More...
 
(void) - updateHeaderFooter:
 Update header-footer.
More...
 

Properties

FSPDFDocDisplayMode displayMode
 Get or Set the display mode.
More...
 
int fileVersion
 Get or Set PDF file version stored in PDF header section.

 

Detailed Description

A PDF document object can be constructed with an existing PDF file from file path, memory buffer, a custom implemented FSFileReaderCallback object and an input file stream. And then call function FSPDFDoc::load: or FSPDFDoc::startLoad:is_cache_stream:pause: to load document content. This class offers functions to retrieve different part of a PDF document. For example:

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 FSForm object with PDF document object.
  • To access additional actions, please construct an FSAdditionalAction object with PDF document object.
  • To access viewer preferences information, please construct a FSDocViewerPrefs object with PDF document object.
  • To access metadata information, please construct a FSMetadata object with PDF document object.
  • To manage page labels information, please construct a FSPageLabels object with PDF document object.
  • To search among a PDF file, please construct a FSTextSearch object with PDF document object.
  • To access layers, please construct a FSLayerTree object with PDF document object. And to render layers, please constructor a FSLayerContext object with PDF document object.
  • To construct a new FSFileSpec object.
  • To manage associated files, please construct an FSAssociatedFiles object with PDF document object.
  • To access name tree, please construct a FSPDFNameTree object with PDF document object. Specially, for EmbeddedFiles name tree, an FSAttachments object can be constructed with PDF document object, for convenient use.
  • To do redaction, please construct a FSRedaction object with PDF document object.


See also
FSForm
FSAdditionalAction
FSDocViewerPrefs
FSMetadata
FSPageLabels
FSTextSearch
FSLayerTree
FSLayerContext
FSFileSpec
FSAssociatedFiles
FSPDFNameTree
FSAttachments
FSRedaction

Method Documentation

◆ addHeaderFooter:()

- (void) addHeaderFooter: (FSHeaderFooter*)  headerfooter

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]headerfooterA valid header-footer object to be added to current document.
Returns
None.

◆ addIndirectObject:()

- (unsigned int) addIndirectObject: (FSPDFObject*)  pdf_object

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_objectA FSPDFObject object. It should not be nil.
Returns
The new indirect object number. It would be above 0.

◆ addPageFromTemplate:()

- (FSPDFPage *) addPageFromTemplate: (NSString *)  template_name

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 FSPDFNameTree (initialized with type FSPDFNameTreeTemplates) 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_nameThe 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 FSErrParam will be thrown.
Returns
A new PDF page object if input template name was found.

◆ addPagingSealSignature:width:height:()

- (FSPagingSealSignature *) addPagingSealSignature: (FSRange*)  page_range
width: (float)  width
height: (float)  height 

Add a paging seal signature to document by page range.

This function will add a signature to the first page of current document, this signature will be hidden.

Parameters
[in]page_rangeA range object that specifies some pages. These pages will be added a Annot::PagingSeal annotation. 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 Annot::PagingSeal annotation. This function does not support a range with a single index. The valid page range: from 1 to count. count is returned by function FSPDFDoc::getPageCount.
[in]widthThe width of paging seal. The value will be used for setting rectangle of the Annot::PagingSeal annotation.
[in]heightThe height of paging seal. The value will be used for setting rectangle of the Annot::PagingSeal annotation.
Returns
A paging seal signature object.

◆ addTableOfContents:bookmark_level_array:()

- (void) addTableOfContents: (NSString *)  title
bookmark_level_array: (FSInt32Array*)  bookmark_level_array 

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]titleTitle for the table of contents. If this is an empty string, the default value "Table of Contents" will be used.
[in]bookmark_level_arrayA 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 FSPDFDoc::getBookmarkLevelDepth. If input array is an empty array, that means all bookmarks are used to generate "Table of Contents".
Returns
None.

◆ addTableOfContentsWithTableOfContentsConfig:()

- (void) addTableOfContentsWithTableOfContentsConfig: (FSTableOfContentsConfig*)  table_of_contents_config

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_configA table of contents configuration object which is used for the table of contents.
Returns
None.

◆ checkPassword:()

- (FSPDFDocPasswordType) checkPassword: (NSString *)  password

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 FSPDFDoc::isUserPassword: and FSPDFDoc::isOwnerPassword: can help to do more check.

Parameters
[in]passwordA password string to be detected.
Returns
Password type. Please refer to values starting from FSPDFDocPwdInvalid and this would be one of these values.

◆ clearRenderCache()

- (void) clearRenderCache

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

Returns
None.

◆ createDSS()

- (void) createDSS

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()

- (FSBookmark *) createRootBookmark

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.

◆ deleteIndirectObject:()

- (void) deleteIndirectObject: (unsigned int)  object_number

Delete an indirect object by indirect object number.

Parameters
[in]object_numberThe indirect object number. It should be above 0.
Returns
None.

◆ doJSOpenAction()

- (BOOL) doJSOpenAction

Perform JavaScript actions when the document is opened.

Returns
YES means success, while NO means failure.

◆ exportAnnotToFDF:fdf_doc:()

- (BOOL) exportAnnotToFDF: (FSAnnot*)  pdf_annot
fdf_doc: (FSFDFDoc*)  fdf_doc 

Export specified annotation to a FDF/XFDF document.

Parameters
[in]pdf_annotA valid PDF annotation object to be exported to the FDF/XFDF document.
[in]fdf_docA valid FDF/XFDF document object, to which the specified annotation will be exported.
Returns
YES means success, while NO means failure.

◆ exportFormFieldsToFDF:is_include:fdf_doc:()

- (BOOL) exportFormFieldsToFDF: (FSFieldArray*)  field_array
is_include: (BOOL)  is_include
fdf_doc: (FSFDFDoc*)  fdf_doc 

Export specified form fields to a FDF/XFDF document.

Parameters
[in]field_arrayAn array of form fields. Parameter is_include will decide whether data of these form fields are to exported or not.
[in]is_includeA boolean value used to decide whether data of specified form fields are to be exported or not: YES means data of specified form fields are to be exported, while NO means data of specified form fields are not to be exported.
[in]fdf_docA valid FDF/XFDF document object, to which the specified form fields will be exported.
Returns
YES means success, while NO means failure.

◆ exportToFDF:types:page_range:()

- (BOOL) exportToFDF: (FSFDFDoc*)  fdf_doc
types: (int)  types
page_range: (FSRange*)  page_range 

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_docA valid FDF/XFDF document object, to which form fields and annotations will be exported.
[in]typesUsed to decide which kind of data will be exported. Please refer to values starting from FSPDFDocForms and this can be one or a combination of these values.
[in]page_rangeA 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 FSPDFDocAnnots.

Returns
YES means success, while NO means failure.

◆ getBookmarkLevelDepth()

- (int) getBookmarkLevelDepth

Get bookmark level depth.

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

◆ getCatalog()

- (FSPDFDictionary *) getCatalog

Get the catalog dictionary.

Returns
The catalog dictionary.

◆ getCertificateEncryptData()

- (FSCertificateEncryptData *) getCertificateEncryptData

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()

- (FSCustomEncryptData *) getCustomEncryptData

Get encrypt data of custom encryption.

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

Returns
The encrypt data of custom encryption.

◆ getDRMEncryptData()

- (FSDRMEncryptData *) getDRMEncryptData

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()

- (FSHeaderFooter *) getEditableHeaderFooter

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()

- (FSEmbeddedFontData *) getEmbeddedFontData

Get embedded font data.

Returns
The embedded font data.

◆ getEncryptDict()

- (FSPDFDictionary *) getEncryptDict

Get the encrypt dictionary.

Returns
The encrypt dictionary.

◆ getEncryptionType()

- (FSPDFDocEncryptType) getEncryptionType

Get the encryption type.

Returns
Encryption type. Please refer to values starting from FSPDFDocEncryptNone and this would be one of these values.

◆ getFileSize()

- (unsigned long long) getFileSize

Get file size.

Returns
File size.

◆ getFirstAvailPageIndex()

- (int) getFirstAvailPageIndex

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:()

- (FSFont *) getFont: (int)  index

Get a font by index.

Parameters
[in]indexThe index of PDF font. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getFontCount.
Returns
A font object.

◆ getFontCount()

- (int) getFontCount

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()

- (NSString *) getHeader

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:()

- (FSPDFObject *) getIndirectObject: (unsigned int)  object_number

Get an indirect object by indirect object number.

Parameters
[in]object_numberThe indirect object number. It should be above 0.
Returns
A FSPDFObject object that receives the indirect PDF object. nil means not found.

◆ getInfo()

- (FSPDFDictionary *) getInfo

Get the information dictionary.

Document's information dictionary contains metadata for the document.

Returns
The information dictionary.

◆ getOpenAction()

- (FSAction *) getOpenAction

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

Returns
An Action object.

◆ getPage:()

- (FSPDFPage *) getPage: (int)  index

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 FSErrDataNotReady. In this case, user should prepare data for specified range informed by callback function FSAsyncReaderCallback::addDownloadHint:size: and then call this function again.

Parameters
[in]indexThe page index. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.
Returns
A PDF page object.

◆ getPageBasicInfo:()

- (FSPageBasicInfo *) getPageBasicInfo: (int)  index

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 FSErrDataNotReady. In this case, user should prepare data for specified range informed by callback function FSAsyncReaderCallback::addDownloadHint:size: and then call this function again.

Parameters
[in]indexThe page index. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.
Returns
A page basic information object which contains the basic information of specified page.

◆ getPageCount()

- (int) getPageCount

Get the count of pages.

Returns
The count of pages.

◆ getPagesDict()

- (FSPDFDictionary *) getPagesDict

Get the dictionary of "Pages".

Returns
The dictionary of "Pages".

◆ getPageText:()

- (NSString *) getPageText: (int)  page_index

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

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.
Returns
All the text content of the related PDF page which the text is in display order.

◆ getPasswordType()

- (FSPDFDocPasswordType) getPasswordType

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 FSPDFDocPwdNoPassword.
If current document is constructed from an existing file but has not been loaded yet, this function will return FSPDFDocPwdInvalid.

Returns
Password type. Please refer to values starting from FSPDFDocPwdInvalid and this would be one of these values.

◆ getPayLoadData()

- (FSPayLoadData *) getPayLoadData

Get payload data if current document's wrapper type is FSPDFDocWrapperPDFV2.

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

◆ getReadingBookmark:()

- (FSReadingBookmark *) getReadingBookmark: (int)  index

Get a reading bookmark by index.

Parameters
[in]indexThe index of reading bookmarks. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getReadingBookmarkCount.
Returns
The reading bookmark object with specified index.

◆ getReadingBookmarkCount()

- (int) getReadingBookmarkCount

Get the count of reading bookmarks.

Returns
The count of reading bookmarks.

◆ getRMSEncryptData()

- (FSRMSEncryptData *) getRMSEncryptData

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 FSLibrary::initialize:key:, that means user has no right in using RMS related functions and this function will throw exception FSErrNoRMSModuleRight.

◆ getRootBookmark()

- (FSBookmark *) getRootBookmark

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 FSBookmark::isEmpty returns YES.

◆ getSecurityHandler()

- (FSSecurityHandler *) getSecurityHandler

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 FSLibrary::initialize:key:, that means user has no right in using RMS related functions and this function will throw exception FSErrNoRMSModuleRight.

◆ getSignature:()

- (FSSignature *) getSignature: (int)  index

Get a signature by index.

Parameters
[in]indexThe index of signature. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getSignatureCount.
Returns
The signature object.

◆ getSignatureCount()

- (int) getSignatureCount

Get the count of signature.

Returns
The count of signature.

◆ getStdEncryptData()

- (FSStdEncryptData *) getStdEncryptData

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()

- (FSPDFDictionary *) getTrailer

Get the trailer dictionary.

Returns
The trailer dictionary.

◆ getUserPassword:()

- (NSString *) getUserPassword: (NSString *)  owner_password

Get the user password based on owner password.

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

Parameters
[in]owner_passwordOwner password string.
Returns
The user password string.

◆ getUserPermissions()

- (unsigned int) getUserPermissions

Get user access permissions.

Returns
User access permission. Please refer to values starting from FSPDFDocPermPrint and this would be one of these values.

◆ getWrapperData()

- (FSWrapperData *) getWrapperData

Get wrapper data if current document's wrapper type is FSPDFDocWrapperFoxit.

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

◆ getWrapperOffset()

- (long long) getWrapperOffset

Get wrapper offset if current document's wrapper type is FSPDFDocWrapperFoxit.

Returns
The wrapper offset. If no wrapper data can be found or current document's wrapper type is not FSPDFDocWrapperFoxit, -1 will be returned.

◆ getWrapperType()

- (FSPDFDocWrapperType) getWrapperType

Get Wrapper type.

Returns
The wrapper type. Please refer to values starting from FSPDFDocWrapperNone and this would be one or combination of its values.

◆ hasForm()

- (BOOL) hasForm

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 FSErrDataNotReady. In this case, user should prepare data for specified range informed by callback function FSAsyncReaderCallback::addDownloadHint:size: and then call this function again.

Returns
YES means current document has interactive form. NO means current document does not have interactive form.

◆ hasHeaderFooter()

- (BOOL) hasHeaderFooter

Check whether current document has header-footer.

Returns
YES means current document has header-footer, while NO means current document does not have header-footer.

◆ hasLayer()

- (BOOL) hasLayer

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

Returns
YES means current document has layer. NO means current document does not have layer.

◆ hidePageTemplate:()

- (BOOL) hidePageTemplate: (NSString *)  template_name

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 FSPDFNameTree (initialized with type FSPDFNameTreePages) 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_nameThe name of a PDF page to be hidden.
Returns
YES means success, while NO means failure.

◆ importFromFDF:types:page_range:()

- (BOOL) importFromFDF: (FSFDFDoc*)  fdf_doc
types: (int)  types
page_range: (FSRange*)  page_range 

Import form fields and annotations from 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_docA valid FDF/XFDF document object, from which form fields and annotations will be imported.
[in]typesUsed to decide which kind of data will be imported. Please refer to values starting from FSPDFDocForms and this can be one or a combination of these values.
[in]page_rangeA 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 FSPDFDocAnnots.

Returns
YES means success, while NO means failure.

◆ init()

- (id) init

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.

◆ initWithBuffer:()

- (id) initWithBuffer: (NSData *)  buffer

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 FSPDFDoc .

Parameters
[in]bufferA memory buffer, containing the serialized document. The PDF document data should be fully loaded in this memory buffer. It should not be nil.

◆ initWithFile_read:is_async:()

- (id) initWithFile_read: (id<FSFileReaderCallback>)  file_read
is_async: (BOOL)  is_async 

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 FSPDFDoc .

Parameters
[in]file_readA FSFileReaderCallback object which is implemented by user to load a PDF document. It should not be nil. If the input callback object is an FSAsyncReaderCallback object, and is_async is YES that means the PDF document will be loaded by asynchronous method; otherwise, the document will be loaded in common way.
[in]is_asyncWhether the input FSFileReaderCallback object is for asynchronously loading or not. Default value: NO.

◆ initWithOther:()

- (id) initWithOther: (FSPDFDoc*)  other

Constructor, with another PDF document object.

Parameters
[in]otherAnother PDF document object.

◆ initWithPath:()

- (id) initWithPath: (NSString *)  path

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 FSPDFDoc .

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

◆ insertDocument:src_doc:options:()

- (void) insertDocument: (int)  dest_index
src_doc: (FSPDFDoc*)  src_doc
options: (unsigned int)  options 

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

Parameters
[in]dest_indexA 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_docA 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]optionsOptions for inserting a PDF document. Please refer to values starting from FSPDFDocInsertDocOptionAttachments and this can be one or a combination of these values. 0 means no option is used.
Returns
None.

◆ insertPage:width:height:()

- (FSPDFPage *) insertPage: (int)  index
width: (float)  width
height: (float)  height 

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

Parameters
[in]indexThe 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]widthWidth of new page (unit is 1/72 inch).
[in]heightHeight of new page (unit is 1/72 inch).
Returns
A new PDF page object which represents a blank page.

◆ insertPageWithType:size:()

- (FSPDFPage *) insertPageWithType: (int)  index
size: (FSPDFPageSize size 

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

Parameters
[in]indexThe 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]sizeSize type of new page. Please refer to values starting from FSPDFPageSizeLetter and this should be one of these values.
Returns
A new PDF page object, which represents a blank page.

◆ insertReadingBookmark:title:dest_page_index:()

- (FSReadingBookmark *) insertReadingBookmark: (int)  reading_bookmark_index
title: (NSString *)  title
dest_page_index: (int)  dest_page_index 

Insert a reading bookmark to current PDF document.

Parameters
[in]reading_bookmark_indexA 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]titleTitle string for new reading bookmark and should not an empty string.
[in]dest_page_indexThe index of destination page.
Returns
A new reading bookmark object.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ isEncrypted()

- (BOOL) isEncrypted

Check whether current document is an encrypted file or not.

Returns
YES means current document is an encrypted file, while NO means current document is not an encrypted file.

◆ isLinearized()

- (BOOL) isLinearized

Check if current PDF document is a linearized file.

  • If current document object is constructed with an FSAsyncReaderCallback 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 FSAsyncReaderCallback::addDownloadHint:size: to notify application the range of data which should be downloaded by application then, and then this function will throw exception FSErrDataNotReady.
  • If current document object is constructed from other methods or with a common FSFileReaderCallback object, this function can only be used after the document is loaded successfully; otherwise, exception FSErrUnknownState will be thrown.


Returns
YES means current PDF document is a linearized file, and NO means current PDF document is not a linearized file.

◆ isOwnerPassword:()

- (BOOL) isOwnerPassword: (NSString *)  password

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

Parameters
[in]passwordA password string to be detected.
Returns
YES means input password is the owner password of current PDF document, while NO means input password is not the owner password of current PDF document.

◆ isPortfolio()

- (BOOL) isPortfolio

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

Returns
YES means current PDF document is a portfolio file, while NO means not.

◆ isTaggedPDF()

- (BOOL) isTaggedPDF

Check if current PDF document is a Tagged PDF file.

Returns
YES means current PDF document is a Tagged PDF file, and NO means current PDF document is not a Tagged PDF file.

◆ isUserPassword:()

- (BOOL) isUserPassword: (NSString *)  password

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

Parameters
[in]passwordA password string to be detected.
Returns
YES means input password is the user password of current PDF document, while NO means input password is not the user password of current PDF document.

◆ isWrapper()

- (BOOL) isWrapper

Check whether current document is a wrapper file or not.

Returns
YES means current document is a wrapper file, while NO means current document is not a wrapper file.

◆ isXFA()

- (BOOL) isXFA

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
YES means current document is an XFA document, while NO means current document is not an XFA document.

◆ load:()

- (FSErrorCode) load: (NSString *)  password

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 FSErrDataNotReady. In this case, user should prepare data for specified range informed by callback function FSAsyncReaderCallback::addDownloadHint:size: and then call this function again.

Parameters
[in]passwordThe 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.
Returns
FSErrSuccess means success.
FSErrFile means there is any error occurs when accessing to current document content.
FSErrPassword means input password is wrong.
FSErrFormat means the format of current document content is not PDF or the file is corrupted.
FSErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
FSErrCertificate 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 FSErrSuccess for more details.

◆ loadW:()

- (FSErrorCode) loadW: (NSString *)  password

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 FSErrDataNotReady. In this case, user should prepare data for specified range informed by callback function FSAsyncReaderCallback::addDownloadHint:size: and then call this function again.

Parameters
[in]passwordThe 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.
Returns
FSErrSuccess means success.
FSErrFile means there is any error occurs when accessing to current document content.
FSErrPassword means input password is wrong.
FSErrFormat means the format of current document content is not PDF or the file is corrupted.
FSErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
FSErrCertificate 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 FSErrSuccess for more details.

◆ movePagesTo:dest_index:()

- (BOOL) movePagesTo: (FSRange*)  page_range
dest_index: (int)  dest_index 

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

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

Parameters
[in]page_rangeA 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_indexIndex of the destination position, based on current page array. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.

Returns
YES means success or no need to move current page, while NO means failure.

◆ movePageTo:dest_index:()

- (BOOL) movePageTo: (FSPDFPage*)  page
dest_index: (int)  dest_index 

Move a specified page to a new index position.

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

Parameters
[in]pageA PDF page to be moved. It should be in current PDF document.
[in]dest_indexIndex of the destination position in page array. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.
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 YES directly.
Returns
YES means success or no need to move current page, while NO means failure.

◆ removeAllHeaderFooters()

- (BOOL) removeAllHeaderFooters

Remove all header-footers.

Returns
YES means success, while NO means failure.

◆ removeBookmark:()

- (BOOL) removeBookmark: (FSBookmark*)  bookmark

Remove a specified bookmark.

Parameters
[in]bookmarkThe valid bookmark that would be deleted.
Returns
YES means success, while NO means failure.

◆ removeOpenAction()

- (BOOL) removeOpenAction

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

Returns
YES means success, while NO means failure.

◆ removePage:()

- (BOOL) removePage: (int)  index

Remove a PDF page by page index.

Parameters
[in]indexThe page index. Valid range: from 0 to (count-1). count is returned by function FSPDFDoc::getPageCount.
Returns
YES means success, while NO means failure.

◆ removePageWithPDFPage:()

- (BOOL) removePageWithPDFPage: (FSPDFPage*)  page

Remove a specified PDF page.

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

Parameters
[in]pageA PDF page object that represents the PDF page to be removed. The page should be in current PDF document.
Returns
YES means success, while NO means failure.

◆ removeReadingBookmark:()

- (BOOL) removeReadingBookmark: (FSReadingBookmark*)  reading_bookmark

Remove a reading bookmark from current PDF document.

Parameters
[in]reading_bookmarkA valid reading bookmark to be removed.
Returns
YES means success, while NO means failure.

◆ removeSecurity()

- (BOOL) removeSecurity

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

Returns
YES means success, while NO means failure.
Note
If module "RMS" is not defined in the license information which is used in function FSLibrary::initialize:key:, that means user has no right in using RMS related functions and this function will throw exception FSErrNoRMSModuleRight.

◆ removeSignature:()

- (void) removeSignature: (FSSignature*)  signature

Remove a signature.

Parameters
[in]signatureA valid signature to be removed.
Returns
None.

◆ saveAs:save_flags:()

- (BOOL) saveAs: (NSString *)  file_path
save_flags: (unsigned int)  save_flags 

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 FSPDFDoc::fileVersion before saving, Foxit PDF SDK will ignore FSPDFDocSaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from FSPDFDocSaveFlagNormal and this can be one or combination of these values.
Returns
YES means the saving is successfully finished, while NO 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:wrapper_data:user_permissions:owner_password:()

- (BOOL) saveAsWrapperFile: (NSString *)  file_path
wrapper_data: (FSWrapperData*)  wrapper_data
user_permissions: (unsigned int)  user_permissions
owner_password: (NSString *)  owner_password 

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_pathA full path of a PDF file. Current PDF document will be saved into this PDF file as a wrapper file.
[in]wrapper_dataWrapper data. If this is nil, no wrapper data is used.
[in]user_permissionsUser permissions for the wrapper document. Pass 0xFFFFFFFC if no special permissions is needed. Please refer to values starting from FSPDFDocPermPrint and this should be one or combination of these values. Default value: 0xFFFFFFFC.
[in]owner_passwordOwner password. If this is an empty string, parameter user_permissions will be ignored.
Returns
YES means success, while NO means failure.

◆ setCacheFile:is_own_file_stream:()

- (void) setCacheFile: (id<FSFileStreamCallback>)  file_stream
is_own_file_stream: (BOOL)  is_own_file_stream 

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_streamA FSFileStreamCallback object which is implemented by user to cache data. It can be nil. The origin cache file will be released if it is nil.
Returns
None.

◆ setOpenAction:()

- (BOOL) setOpenAction: (FSAction*)  action

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

Parameters
[in]actionA valid action to be set. Currently only support following types as the new action:
FSActionTypeGoto, FSActionTypeURI, FSActionTypeJavaScript, FSActionTypeNamed, FSActionTypeSubmitForm, FSActionTypeResetForm, FSActionTypeHide, FSActionTypeImportData.
Returns
YES means success, while NO means failure.

◆ setSecurityHandler:()

- (BOOL) setSecurityHandler: (FSSecurityHandler*)  handler

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

Parameters
[in]handlerA PDF security handler object.
Returns
YES means success, while NO means failure.
Note
If module "RMS" is not defined in the license information which is used in function FSLibrary::initialize:key:, that means user has no right in using RMS related functions and this function will throw exception FSErrNoRMSModuleRight.

◆ startExtractPages:options:page_range:pause:()

- (FSProgressive *) startExtractPages: (NSString *)  file_path
options: (unsigned int)  options
page_range: (FSRange*)  page_range
pause: (id<FSPauseCallback>)  pause 

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_pathA full path for the new saved PDF file which is used to save the extracted pages. It should not be an empty string.
[in]optionsOptions for extracting pages. Please refer to values starting from FSPDFDocExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
[in]page_rangeA 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.
[in]pausePause object which decides if the extracting process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startExtractPagesWithWriterCallback:options:page_range:pause:()

- (FSProgressive *) startExtractPagesWithWriterCallback: (id<FSFileWriterCallback>)  file
options: (unsigned int)  options
page_range: (FSRange*)  page_range
pause: (id<FSPauseCallback>)  pause 

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]fileA FSFileWriterCallback object which is implemented by user to store the data of all the extracted pages in custom method.
[in]optionsOptions for extracting pages. Please refer to values starting from FSPDFDocExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
[in]page_rangeA 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.
[in]pausePause object which decides if the extracting process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startGetPayloadFile:pause:()

- (FSProgressive *) startGetPayloadFile: (id<FSFileWriterCallback>)  payload_file
pause: (id<FSPauseCallback>)  pause 

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_fileA 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]pausePause callback object which decides if the parsing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startImportPages:src_doc:flags:layer_name:page_range:pause:()

- (FSProgressive *) startImportPages: (int)  dest_index
src_doc: (FSPDFDoc*)  src_doc
flags: (unsigned int)  flags
layer_name: (NSString *)  layer_name
page_range: (FSRange*)  page_range
pause: (id<FSPauseCallback>)  pause 

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.
From Foxit PDF SDK 7.1, user is strongly recommended to use functions FSPDFDoc::startExtractPages:options:page_range:pause: and FSPDFDoc::insertDocument:src_doc:options: together, instead of current function. Execution efficiency of importing pages has been optimized in new functions.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_indexA 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_docA 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]flagsOptions for importing pages. Please refer to values starting from FSPDFDocImportFlagNormal and this can be one or a combination of these values.
[in]layer_nameThe name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application.
If parameter flags contains FSPDFDocImportFlagWithLayers, this should not be empty and should be a valid string. If parameter flags does not contain FSPDFDocImportFlagWithLayers, 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_rangeA 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.
[in]pausePause object which decides if the importing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startImportPagesFromFilePath:src_file_path:password:flags:layer_name:page_range:pause:()

- (FSProgressive *) startImportPagesFromFilePath: (int)  dest_index
src_file_path: (NSString *)  src_file_path
password: (NSString *)  password
flags: (unsigned int)  flags
layer_name: (NSString *)  layer_name
page_range: (FSRange*)  page_range
pause: (id<FSPauseCallback>)  pause 

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.
From Foxit PDF SDK 7.1, user is strongly recommended to use functions FSPDFDoc::startExtractPages:options:page_range:pause: and FSPDFDoc::insertDocument:src_doc:options: together, instead of current function. Execution efficiency of importing pages has been optimized in new functions.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_indexA 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_pathA 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]passwordA 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]flagsOptions for importing pages. Please refer to values starting from FSPDFDocImportFlagNormal and this can be one or a combination of these values.
[in]layer_nameThe name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application.
If parameter flags contains FSPDFDocImportFlagWithLayers, this should not be empty and should be a valid string. If parameter flags does not contain FSPDFDocImportFlagWithLayers, 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_rangeA 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.
[in]pausePause object which decides if the importing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startLoad:is_cache_stream:pause:()

- (FSProgressive *) startLoad: (NSString *)  password
is_cache_stream: (BOOL)  is_cache_stream
pause: (id<FSPauseCallback>)  pause 

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]passwordA 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.
[in]is_cache_streamYES means to load stream content into memory, and NO 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.
[in]pausePause object which decides if the loading process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startLoadW:is_cache_stream:pause:()

- (FSProgressive *) startLoadW: (NSString *)  password
is_cache_stream: (BOOL)  is_cache_stream
pause: (id<FSPauseCallback>)  pause 

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]passwordA 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.
[in]is_cache_streamYES means to load stream content into memory, and NO 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.
[in]pausePause object which decides if the loading process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startRecognizeForm:()

- (FSProgressive *) startRecognizeForm: (id<FSPauseCallback>)  pause

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]pausePause callback object which decides if the recognizing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startSaveAs:save_flags:pause:()

- (FSProgressive *) startSaveAs: (NSString *)  file_path
save_flags: (unsigned int)  save_flags
pause: (id<FSPauseCallback>)  pause 

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 FSPDFDoc::fileVersion before saving, Foxit PDF SDK will ignore FSPDFDocSaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from FSPDFDocSaveFlagNormal and this can be one or combination of these values.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::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:payload_file_path:crypto_filter:description:version:save_flags:pause:()

- (FSProgressive *) startSaveAsPayloadFile: (NSString *)  file_path
payload_file_path: (NSString *)  payload_file_path
crypto_filter: (NSString *)  crypto_filter
description: (NSString *)  description
version: (float)  version
save_flags: (unsigned int)  save_flags
pause: (id<FSPauseCallback>)  pause 

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 FSPDFDoc::fileVersion before saving, Foxit PDF SDK will ignore FSPDFDocSaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]payload_file_pathA full path of a PDF document which will be used as payload document. It should not be an empty string.
[in]crypto_filterThe name of the cryptographic filter used to encrypt the encrypted payload document.
[in]descriptionDescription for wrapper file to show applications or confront users prompt information.
[in]versionThe version number of the cryptographic filter used to encrypt the encrypted payload referenced by this dictionary.
[in]save_flagsDocument saving flags. Please refer to values starting from FSPDFDocSaveFlagNormal and this can be one or combination of these values.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::resume to continue the progress until the progress is finished.

◆ startSaveAsWithWriterCallback:save_flags:pause:()

- (FSProgressive *) startSaveAsWithWriterCallback: (id<FSFileWriterCallback>)  file
save_flags: (unsigned int)  save_flags
pause: (id<FSPauseCallback>)  pause 

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 FSPDFDoc::fileVersion before saving, Foxit PDF SDK will ignore FSPDFDocSaveFlagIncremental in parameter save_flags and use the file version in saved PDF file.

Parameters
[in]fileA FSFileWriterCallback object which is implemented by user to save a PDF document.
[in]save_flagsDocument saving flags. Please refer to values starting from FSPDFDocSaveFlagNormal and this can be one or combination of these values.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be nil which means not to pause during the parsing process. If this is not nil, it should be a valid pause object implemented by user.
Returns
A progressive object. Please check the rate of current progress by function FSProgressive::getRateOfProgress. If the rate is not 100 yet, call function FSProgressive::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.

◆ updateHeaderFooter:()

- (void) updateHeaderFooter: (FSHeaderFooter*)  headerfooter

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]headerfooterA valid header-footer object to be updated to current document.
Returns
None.

Property Documentation

◆ displayMode

- (FSPDFDocDisplayMode) displayMode
readwritenonatomicassign

Get or Set the display mode.

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