PDF Document

Definitions for access to PDF document.
Definitions and functions in this module are included in fpdf_document_r.h and fpdf_document_w.h.
Module: PDFDocument
License Identifier: PDFDocument/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_document_r.h.
For License Right Writing, see fpdf_document_w.h. More...

Classes

struct  FSPDF_ENUMPAGEINFOHANDLER
 Structure for page information enumeration. More...
 
struct  FSPDF_WRAPPERDATA
 Structure for wrapper data. More...
 
struct  FSPDF_IDENTITYPROPERTIES
 Structure for identity properties of the current user of the application. More...
 
struct  FSPDF_MENULIST
 Structure for menu list. More...
 
struct  FSPDF_JAVASCRIPTACTION_HANDLER
 Structure for action handler information. More...
 
struct  FSPDF_BOOKMARK_ITERATOR
 Handle type to PDF bookmark iterator. More...
 
struct  FSPDF_BOOKMARKPOS
 Handle type to PDF bookmark position. More...
 
struct  FSPDF_BOOKMARKDATA
 Structure for bookmark data. More...
 
struct  FSPDF_ATTACHMENTS
 Handle type to PDF attachments. More...
 

Functions

FS_RESULT FSPDF_Doc_StartLoad (FSCRT_FILE file, const FSCRT_BSTR *password, FSCRT_DOCUMENT *document, FSCRT_PROGRESS *progress)
 Load a PDF file. More...
 
FS_RESULT FSPDF_Doc_StartLoadWithFlag (FSCRT_FILE file, const FSCRT_BSTR *password, FS_DWORD flag, FSCRT_DOCUMENT *document, FSCRT_PROGRESS *progress)
 Load a PDF file with the extra flags. More...
 
FS_RESULT FSPDF_Doc_StartReLoad (FSCRT_DOCUMENT document, FSCRT_FILE file, const FSCRT_BSTR *password, FSCRT_PROGRESS *progress)
 Reload PDF file. More...
 
FS_RESULT FSPDF_Doc_Close (FSCRT_DOCUMENT document)
 Close a PDF document. More...
 
FS_RESULT FSPDF_Doc_GetCatalog (FSCRT_DOCUMENT document, FSPDF_OBJECT *object)
 Get the PDF document catalog object. More...
 
FS_RESULT FSPDF_Doc_GetTrailer (FSCRT_DOCUMENT document, FSPDF_OBJECT *trailer)
 Get the PDF document trailer dictionary. More...
 
FS_RESULT FSPDF_Doc_GetInfoDict (FSCRT_DOCUMENT document, FSPDF_OBJECT *object)
 Get the PDF document info object. More...
 
FS_RESULT FSPDF_Doc_GetEncryptDict (FSCRT_DOCUMENT document, FSPDF_OBJECT *object)
 Get the PDF document encrypt dictionary. More...
 
FS_RESULT FSPDF_Doc_GetPasswordType (FSCRT_DOCUMENT document, FS_INT32 *type)
 Get current password type. More...
 
FS_RESULT FSPDF_Doc_GetEncryptionType (FSCRT_DOCUMENT document, FS_INT32 *type)
 Get current encryption type. More...
 
FS_RESULT FSPDF_Doc_GetEncryptionFilter (FSCRT_DOCUMENT document, FSCRT_BSTR *filter)
 Get encryption filter value. More...
 
FS_RESULT FSPDF_Doc_GetEncryptionSubFilter (FSCRT_DOCUMENT document, FSCRT_BSTR *subFilter)
 Get encryption sub-filter value. More...
 
FS_RESULT FSPDF_Doc_GetEncryptionParam (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, FSCRT_BSTR *value)
 Get encryption parameter value. More...
 
FS_RESULT FSPDF_Doc_GetUserPermissions (FSCRT_DOCUMENT document, FS_DWORD *permissions)
 Get user permissions specified in PDF document. More...
 
FS_RESULT FSPDF_Doc_GetDisplayMode (FSCRT_DOCUMENT document, FS_INT32 *displayMode)
 Get display mode specified in PDF document. More...
 
FS_RESULT FSPDF_Doc_GetFileVersion (FSCRT_DOCUMENT document, FS_INT32 *version)
 Get PDF file version stored in PDF header section. More...
 
FS_RESULT FSPDF_Doc_IsModified (FSCRT_DOCUMENT document, FS_BOOL *isModified)
 Get PDF document modify mark. More...
 
FS_RESULT FSPDF_Doc_IsPortfolio (FSCRT_DOCUMENT document, FS_BOOL *isPortfolio)
 Whether a document is a portfolio file or not. More...
 
FS_RESULT FSPDF_Doc_CountPages (FSCRT_DOCUMENT document, FS_INT32 *count)
 Get page count in document. More...
 
FS_RESULT FSPDF_Doc_GetPage (FSCRT_DOCUMENT document, FS_INT32 index, FSCRT_PAGE *page)
 Get a page object. More...
 
FS_RESULT FSPDF_Doc_EnumPagesInfo (FSCRT_DOCUMENT document, FSPDF_ENUMPAGEINFOHANDLER *enumHandler)
 Enumerate the information of all PDF pages. More...
 
FS_RESULT FSPDF_WrapperData_Init (FSPDF_WRAPPERDATA *wrapperData)
 Helper function to initialize a wrapper data object. More...
 
FS_RESULT FSPDF_WrapperData_Clear (FSPDF_WRAPPERDATA *wrapperData)
 Helper function to clear a wrapper data object. More...
 
FS_RESULT FSPDF_Doc_IsWrapper (FSCRT_DOCUMENT document, FS_BOOL *isWrapper)
 Determine whether the document is a wrapper document or not. More...
 
FS_RESULT FSPDF_Doc_GetWrapperOffset (FSCRT_DOCUMENT document, FSCRT_FILESIZE *offset)
 Get wrapper offset. More...
 
FS_RESULT FSPDF_Doc_GetWrapperData (FSCRT_DOCUMENT document, FSPDF_WRAPPERDATA *wrapperData)
 Get wrapper data. More...
 
FS_RESULT FSPDF_Doc_CountActions (FSCRT_DOCUMENT document, FS_INT32 trigger, FS_INT32 *count)
 Get the count of document trigger actions. More...
 
FS_RESULT FSPDF_Doc_GetAction (FSCRT_DOCUMENT document, FS_INT32 trigger, FS_INT32 index, FSPDF_ACTIONDATA *actionData)
 Get document trigger action. More...
 
FS_RESULT FSPDF_Doc_SetJavaScriptActionHandler (FSCRT_DOCUMENT document, FSPDF_JAVASCRIPTACTION_HANDLER *actionHandler)
 Set the action handler to the PDF document. More...
 
FS_RESULT FSPDF_Doc_InitiateJavaScript (FSCRT_DOCUMENT document)
 Perform the document javascript when document is opened, defining JavaScript functions for use by other scripts in the document. More...
 
FS_RESULT FSPDF_Doc_DoJavaScriptAction (FSCRT_DOCUMENT document, FS_INT32 trigger)
 Perform the document javascript which is specified by the trigger. More...
 
FS_RESULT FSPDF_Doc_GetJSActionByName (FSCRT_DOCUMENT document, const FSCRT_BSTR *name, FSPDF_ACTIONDATA *actionData)
 Get a document JavaScript action by its action name. More...
 
FS_RESULT FSPDF_Doc_PageLabelToPageIndex (FSCRT_DOCUMENT document, FS_BOOL noCase, const FSCRT_BSTR *pageLabel, FS_INT32 *pageIndex)
 Convert a page label to page index. More...
 
FS_RESULT FSPDF_Doc_PageIndexToPageLabel (FSCRT_DOCUMENT document, FS_INT32 pageIndex, FSCRT_BSTR *pageLabel)
 Convert a page index to page label. More...
 
FS_RESULT FSPDF_PageLabels_CountRanges (FSCRT_DOCUMENT document, FS_INT32 *count)
 Get count of ranges of page labels which use different numbering systems. More...
 
FS_RESULT FSPDF_PageLabels_GetRangeInfo (FSCRT_DOCUMENT document, FS_INT32 rangeIndex, FS_INT32 *start, FS_INT32 *style, FSCRT_BSTR *prefix, FS_INT32 *st)
 Get information of page labels by a specified range. More...
 
FS_RESULT FSPDF_Metadata_GetString (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, FSCRT_BSTR *string)
 Get a UTF-8 string value from metadata. More...
 
FS_RESULT FSPDF_Metadata_GetStringArray (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, FSCRT_ARRAY *stringArray)
 Get an UTF-8 string array value from metadata. More...
 
FS_RESULT FSPDF_Metadata_GetDateTime (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, FSCRT_DATETIMEZONE *dt)
 Get a date and time value from metadata. More...
 
FS_RESULT FSPDF_BookmarkData_Init (FSPDF_BOOKMARKDATA *bmData)
 Helper function to initialize a bookmark data object. More...
 
FS_RESULT FSPDF_BookmarkData_Clear (FSPDF_BOOKMARKDATA *bmData)
 Helper function to clear a bookmark data. More...
 
FS_RESULT FSPDF_Doc_CreateBookmarkIterator (FSCRT_DOCUMENT document, FSPDF_BOOKMARK_ITERATOR *iterator)
 Create an iterator to access bookmark in a document. More...
 
FS_RESULT FSPDF_Bookmark_GetPos (FSPDF_BOOKMARK_ITERATOR iterator, FSPDF_BOOKMARKPOS *pos)
 Get the bookmark position handle from a bookmark iterator. More...
 
FS_RESULT FSPDF_Bookmark_CloneIterator (FSPDF_BOOKMARK_ITERATOR srcIterator, FSPDF_BOOKMARK_ITERATOR *clonedIterator)
 Clone an iterator to access bookmark in a document. More...
 
FS_RESULT FSPDF_Bookmark_ReleaseIterator (FSPDF_BOOKMARK_ITERATOR iterator)
 Release a bookmark iterator. More...
 
FS_RESULT FSPDF_Bookmark_ReleasePos (FSPDF_BOOKMARKPOS pos)
 Release a bookmark position handle. More...
 
FS_RESULT FSPDF_Bookmark_MoveToRoot (FSPDF_BOOKMARK_ITERATOR iterator)
 Move a bookmark iterator to root. More...
 
FS_RESULT FSPDF_Bookmark_IsRoot (FSPDF_BOOKMARK_ITERATOR iterator, FS_BOOL *isRoot)
 Determine whether a bookmark iterator is root or not. More...
 
FS_RESULT FSPDF_Bookmark_MoveToParent (FSPDF_BOOKMARK_ITERATOR iterator)
 Move a bookmark iterator to its parent if existing. More...
 
FS_RESULT FSPDF_Bookmark_MoveToFirstChild (FSPDF_BOOKMARK_ITERATOR iterator)
 Move a bookmark iterator to its first child if existing. More...
 
FS_RESULT FSPDF_Bookmark_MoveToNextSibling (FSPDF_BOOKMARK_ITERATOR iterator)
 Move a bookmark iterator to its next sibling if existing. More...
 
FS_RESULT FSPDF_Bookmark_MoveToPrevSibling (FSPDF_BOOKMARK_ITERATOR iterator)
 Move a bookmark iterator to its previous sibling if existing. More...
 
FS_RESULT FSPDF_Bookmark_MoveToPos (FSPDF_BOOKMARK_ITERATOR iterator, FSPDF_BOOKMARKPOS newPos)
 Move a bookmark iterator to a specific position. More...
 
FS_RESULT FSPDF_Bookmark_HasChild (FSPDF_BOOKMARK_ITERATOR iterator, FS_BOOL *hasChild)
 Detect whether a bookmark iterator has a child or not. More...
 
FS_RESULT FSPDF_Bookmark_IsFirstChild (FSPDF_BOOKMARK_ITERATOR iterator, FS_BOOL *isFirstChild)
 Determine whether a bookmark iterator is the first child of its parent or not. More...
 
FS_RESULT FSPDF_Bookmark_IsLastChild (FSPDF_BOOKMARK_ITERATOR iterator, FS_BOOL *isLastChild)
 Determine whether a bookmark iterator is the last child of its parent or not. More...
 
FS_RESULT FSPDF_Bookmark_GetData (FSPDF_BOOKMARK_ITERATOR iterator, FSPDF_BOOKMARKDATA *bmData)
 Get current bookmark iterator's data which is indicated by parameter iterator. More...
 
FS_RESULT FSPDF_Bookmark_CountActions (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 *count)
 Get counts of bookmark action. More...
 
FS_RESULT FSPDF_Bookmark_GetAction (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 index, FSPDF_ACTIONDATA *actionData)
 Get bookmark action. More...
 
FS_RESULT FSPDF_ViewerPref_GetUIVisibility (FSCRT_DOCUMENT document, const FSCRT_BSTR *uiItem, FS_BOOL *uiVisible)
 Get UI visibility status from viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_GetNonFullScreenPageMode (FSCRT_DOCUMENT document, FS_INT32 *displayMode)
 Get display mode for non full-screen mode from viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_GetReadingDirection (FSCRT_DOCUMENT document, FS_INT32 *direction)
 Get reading direction from viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_GetAreaType (FSCRT_DOCUMENT document, const FSCRT_BSTR *boxItem, FS_INT32 *boxType)
 Get the type of area item from viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_GetPrintScale (FSCRT_DOCUMENT document, FSCRT_BSTR *printScale)
 Get page scaling option from viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_GetPrintCopies (FSCRT_DOCUMENT document, FS_INT32 *copies)
 Get the number of copies to be printed. More...
 
FS_RESULT FSPDF_ViewerPref_GetPrintRanges (FSCRT_DOCUMENT document, FS_INT32 *pageRanges, FS_INT32 *count)
 Get page ranges which allowed to print. More...
 
FS_RESULT FSPDF_Doc_LoadAttachments (FSCRT_DOCUMENT document, FSPDF_ATTACHMENTS *attachments)
 Load all attachments of PDF document. More...
 
FS_RESULT FSPDF_Attachments_Release (FSPDF_ATTACHMENTS attachments)
 Release a attachments object. More...
 
FS_RESULT FSPDF_Attachments_CountAttachment (FSPDF_ATTACHMENTS attachments, FS_INT32 *count)
 Get the count of attachments. More...
 
FS_RESULT FSPDF_Attachments_GetAttachment (FSPDF_ATTACHMENTS attachments, FS_INT32 index, FSPDF_ATTACHMENT *attachment)
 Get a specific attachment. More...
 
FS_RESULT FSPDF_Doc_CountFonts (FSCRT_DOCUMENT document, FS_INT32 *count)
 Count all the PDF fonts in the document, this function would enumerate all the font resources for pages, annots, and AcroForm. More...
 
FS_RESULT FSPDF_Doc_GetFontByIndex (FSCRT_DOCUMENT document, FS_INT32 index, FSCRT_FONT *font)
 Get the specific PDF font in the document. More...
 
FS_RESULT FSPDF_Doc_ClearCache (FSCRT_DOCUMENT document)
 Clear the cache of PDF document(temporarily only for rendering), to reduce the memory usage. More...
 
FS_RESULT FSPDF_Doc_Create (FSCRT_DOCUMENT *document)
 Create a new document object. More...
 
FS_RESULT FSPDF_Doc_StartImportPages (FSCRT_DOCUMENT dstDoc, FS_INT32 startIndex, FSCRT_DOCUMENT srcDoc, const FS_INT32 *pageRanges, FS_INT32 count, FSCRT_PROGRESS *importProgress)
 To start a progressive process of inserting a range of pages from a extra source document into the target document. More...
 
FS_RESULT FSPDF_Doc_StartImportPagesWithLayers (FSCRT_DOCUMENT dstDoc, FS_INT32 startIndex, FSCRT_DOCUMENT srcDoc, const FSCRT_BSTR *layerName, const FS_INT32 *pageRanges, FS_INT32 count, FSCRT_PROGRESS *importProgress)
 To start a progressive process of inserting a range of pages from a extra source document with its layer information into the target document. More...
 
FS_RESULT FSPDF_Doc_StartImportPagesFromFileName (FSCRT_DOCUMENT dstDoc, FS_INT32 startIndex, const FSCRT_BSTR *srcFileName, const FSCRT_BSTR *password, const FSCRT_BSTR *layerName, const FS_INT32 *pageRanges, FS_INT32 count, FS_INT32 flags, FSCRT_PROGRESS *importProgress)
 To start a progressive process of inserting a range of pages from an extra source document which specified by file path to the target document. More...
 
FS_RESULT FSPDF_Doc_StartSaveToFile (FSCRT_DOCUMENT document, FSCRT_FILE file, FS_INT32 flag, FSCRT_PROGRESS *saveProgress)
 Start saving a PDF document to another file in a progressive manner. More...
 
FS_RESULT FSPDF_Doc_SaveAsWrapperFile (FSCRT_DOCUMENT wrapperDoc, FSCRT_FILE file, const FSPDF_WRAPPERDATA *wrapperData, FS_DWORD userPermissions, const FSCRT_BSTR *ownerPassword)
 Save a PDF document as a wrapper file. More...
 
FS_RESULT FSPDF_Doc_SetAction (FSCRT_DOCUMENT document, FS_INT32 trigger, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Set document trigger action. More...
 
FS_RESULT FSPDF_Doc_InsertAction (FSCRT_DOCUMENT document, FS_INT32 trigger, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Insert document trigger action. More...
 
FS_RESULT FSPDF_Doc_RemoveAction (FSCRT_DOCUMENT document, FS_INT32 trigger, FS_INT32 index)
 Remove document trigger action. More...
 
FS_RESULT FSPDF_Doc_RemoveAllActions (FSCRT_DOCUMENT document, FS_INT32 trigger)
 Remove all document trigger action. More...
 
FS_RESULT FSPDF_Doc_RemoveJSActionByName (FSCRT_DOCUMENT document, const FSCRT_BSTR *name)
 Remove a javascript action from the PDF document by the name of javascript action. More...
 
FS_RESULT FSPDF_Doc_SetFileVersion (FSCRT_DOCUMENT document, FS_INT32 version)
 Specify the PDF file version which will be stored in PDF header section. This function does not check whether the PDF matches the specified version. More...
 
FS_RESULT FSPDF_Doc_SetDisplayMode (FSCRT_DOCUMENT document, FS_INT32 displayMode)
 Set display mode specified in PDF document. More...
 
FS_RESULT FSPDF_PageLabels_SetRangeInfo (FSCRT_DOCUMENT document, FS_INT32 start, FS_INT32 style, const FSCRT_BSTR *prefix, FS_INT32 st)
 Set page labels of PDF pages with a specified range. More...
 
FS_RESULT FSPDF_PageLabels_RemoveAll (FSCRT_DOCUMENT document)
 Delete all page labels in the PDF document. More...
 
FS_RESULT FSPDF_Metadata_SetString (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, const FSCRT_BSTR *string)
 Set a UTF-8 string value to parameter key in metadata. More...
 
FS_RESULT FSPDF_Metadata_SetStringArray (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, const FSCRT_BSTR *stringArray, const FS_INT32 count)
 Set an UTF-8 string array value to parameter key in metadata. More...
 
FS_RESULT FSPDF_Metadata_SetDateTime (FSCRT_DOCUMENT document, const FSCRT_BSTR *key, const FSCRT_DATETIMEZONE *dt)
 Set a date value to parameter key in metadata. More...
 
FS_RESULT FSPDF_Bookmark_SetData (FSPDF_BOOKMARK_ITERATOR iterator, const FSPDF_BOOKMARKDATA *bmData)
 Set data to current bookmark positioned by parameter iterator. More...
 
FS_RESULT FSPDF_Bookmark_Insert (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 pos, const FSPDF_BOOKMARKDATA *bmData)
 Insert a new bookmark at parameter pos bookmark position and set the data. More...
 
FS_RESULT FSPDF_Bookmark_InsertAtPos (FSPDF_BOOKMARK_ITERATOR iterator, FSPDF_BOOKMARKPOS newParentPos, FS_INT32 childIndex)
 Insert a bookmark to be the child (with specific index) of another bookmark with specific position and old one with the specific index will be the next sibling. More...
 
FS_RESULT FSPDF_Bookmark_Remove (FSPDF_BOOKMARK_ITERATOR iterator)
 Remove the current bookmark item positioned by parameter iterator. More...
 
FS_RESULT FSPDF_Bookmark_SetAction (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Set bookmark action. More...
 
FS_RESULT FSPDF_Bookmark_InsertAction (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Insert bookmark action. More...
 
FS_RESULT FSPDF_Bookmark_RemoveAction (FSPDF_BOOKMARK_ITERATOR iterator, FS_INT32 index)
 Remove a specific bookmark action. More...
 
FS_RESULT FSPDF_Bookmark_RemoveAllActions (FSPDF_BOOKMARK_ITERATOR iterator)
 Remove all bookmark actions. More...
 
FS_RESULT FSPDF_Bookmark_Update (FSPDF_BOOKMARK_ITERATOR iterator)
 Update specific bookmark iterator object after structure of bookmark tree has been changed. More...
 
FS_RESULT FSPDF_ViewerPref_SetUIVisibility (FSCRT_DOCUMENT document, const FSCRT_BSTR *uiItem, FS_BOOL uiVisible)
 Set UI visibility in viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_SetNonFullScreenPageMode (FSCRT_DOCUMENT document, FS_INT32 displayMode)
 Set display mode for non full-screen mode in viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_SetReadingDirection (FSCRT_DOCUMENT document, FS_INT32 direction)
 Set reading direction in viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_SetAreaType (FSCRT_DOCUMENT document, const FSCRT_BSTR *boxItem, FS_INT32 boxType)
 Set the page box type in viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_SetPrintScale (FSCRT_DOCUMENT document, const FSCRT_BSTR *printScale)
 Set page scaling in viewer preferences. More...
 
FS_RESULT FSPDF_ViewerPref_SetPrintCopies (FSCRT_DOCUMENT document, FS_INT32 copies)
 Set the number of copies to be printed. More...
 
FS_RESULT FSPDF_ViewerPref_SetPrintRanges (FSCRT_DOCUMENT document, const FS_INT32 *pageRanges, FS_INT32 count)
 Set the page ranges to be printed. More...
 
FS_RESULT FSPDF_Attachments_InsertAttachment (FSPDF_ATTACHMENTS attachments, FS_INT32 index, FSPDF_ATTACHMENT attachment)
 Insert an attachment. More...
 
FS_RESULT FSPDF_Attachments_RemoveAttachment (FSPDF_ATTACHMENTS attachments, FSPDF_ATTACHMENT attachment)
 Remove an attachment. More...
 
FS_RESULT FSPDF_Doc_EmbedFont (FSCRT_DOCUMENT document, FSCRT_FONT font)
 Embed a PDF font to the PDF document. More...
 

Macro Definitions for Password Types

Note
A PDF document can have a user password and an owner password.
While loading or reloading a PDF file, a password can be passed to the function FSPDF_Doc_StartLoad or FSPDF_Doc_StartReLoad.
In order to check which type of password is used, applications can call the function FSPDF_Doc_GetPasswordType.
#define FSPDF_PASSWORDTYPE_INVALID   -1
 The password is invalid.
 
#define FSPDF_PASSWORDTYPE_NOPASSWORD   0
 No password is used in PDF document.
 
#define FSPDF_PASSWORDTYPE_USERPASSWORD   1
 A user password is used in PDF document.
 
#define FSPDF_PASSWORDTYPE_OWNERPASSWORD   2
 An owner password is used in PDF document.
 

Macro Definitions for Encryption Types

Note
These types indicate PDF document's encrypted patterns.
#define FSPDF_ENCRYPTTYPE_NOENCRYPT   0
 No encrypt patterns.
 
#define FSPDF_ENCRYPTTYPE_PASSWORD   1
 Encrypt type by password.
 
#define FSPDF_ENCRYPTTYPE_CERTIFICATE   2
 Encrypt type by digital certificate.
 
#define FSPDF_ENCRYPTTYPE_FOXITDRM   3
 Encrypt type by Foxit DRM.
 
#define FSPDF_ENCRYPTTYPE_CUSTOM   4
 Encrypt type by customized encryption function.
 
#define FSPDF_ENCRYPTTYPE_RMS   5
 Encrypt type by Microsoft RMS encryption function.
 

Macro Definitions for Display Modes

Note
PDF defines two situations for PDF applications: one is full-screen and the other one is normal screen.
Function FSPDF_Doc_GetDisplayMode specifies the base display mode, and function FSPDF_ViewerPref_GetNonFullScreenPageMode specifies normal display mode (non full-screen).
Display modes tell how application displays PDF document.
#define FSPDF_DISPLAYMODE_USENONE   0
 Neither document outlines nor thumbnail images are visible.
 
#define FSPDF_DISPLAYMODE_USEOUTLINES   1
 Document outlines (bookmarks) are visible.
 
#define FSPDF_DISPLAYMODE_USETHUMBS   2
 Thumbnail images are visible.
 
#define FSPDF_DISPLAYMODE_FULLSCREEN   3
 Full-screen mode, with no menu bar, window controls, or any other windows are visible.
 
#define FSPDF_DISPLAYMODE_USEOC   4
 Optional content group panels are visible.
 
#define FSPDF_DISPLAYMODE_USEATTACHMENTS   5
 Attachment panels are visible.
 

Macro Definitions for document's loading flag

#define FSPDF_LOADFLAG_NOSTREAMCACHES   0x1
 When load a PDF document, will not cache streams. Loading stream content into memory will improve performance for frequent access, however, it will also consume a lot of memory space. Not to cache streams may reduce the performance a little bit, but greatly reduce the memory consumption, especially when the file is big. The function FSPDF_Doc_StartLoad will cache streams by default.
 
#define FSPDF_LOADFLAG_RELEASEFILEHANDLE   0x2
 If set, the file used to load document will be released automatically.
 

Macro Definitions for application's information type.

#define FSPDF_APPINFOTYPE_FORMSVERSION   0x0
 The type of application forms version information.
 
#define FSPDF_APPINFOTYPE_VIEWERTYPE   0x1
 The type of application viewer type information.
 
#define FSPDF_APPINFOTYPE_VIEWERVARIATION   0x2
 The type of application viewer variation information.
 
#define FSPDF_APPINFOTYPE_VIEWERVERSION   0x3
 The type of application viewer version information.
 
#define FSPDF_APPINFOTYPE_APPVERSION   0x4
 The type of application app version information.
 

Macro Definitions for data type to be mailed.

#define FSPDF_MAILTYPE_DOC   0
 The data to be mailed is a document.
 
#define FSPDF_MAILTYPE_FORM   1
 The data to be mailed is a form.
 
#define FSPDF_MAILTYPE_MSG   2
 The data to be mailed is a string message.
 

Macro Definitions for PDF page label style

Note
These flags indicate numbering styles to be used for the numeric portion of each page label.
#define FSPDF_PAGELABEL_STYLE_None   0
 No numbering style.
 
#define FSPDF_PAGELABEL_STYLE_D   1
 Decimal arabic numerals.
 
#define FSPDF_PAGELABEL_STYLE_R   2
 Uppercase roman numerals.
 
#define FSPDF_PAGELABEL_STYLE_r   3
 Lowercase roman numerals.
 
#define FSPDF_PAGELABEL_STYLE_A   4
 Uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on).
 
#define FSPDF_PAGELABEL_STYLE_a   5
 Lowercase letters (a to z for the first 26 pages, aa to zz for the next 26, and so on).
 

Macros for Bookmark Status

Note
Each bookmark item has the status to indicate how to display it.
Combine the following flags while using them in FSPDF_BOOKMARKDATA::status.
#define FSPDF_BOOKMARKSTATUS_NORMAL   0
 Show title as normal text in bookmark.
 
#define FSPDF_BOOKMARKSTATUS_BOLD   1
 Show title as bold text in bookmark.
 
#define FSPDF_BOOKMARKSTATUS_ITALIC   2
 Show title as italic text in bookmark.
 
#define FSPDF_BOOKMARKSTATUS_EXPANDED   4
 Expand bookmark. More...
 

Macros for Bookmark Position

Note
Bookmark position specifies where a new bookmark item is inserted.
Please refer to function FSPDF_Bookmark_Insert.
#define FSPDF_BOOKMARKPOS_FIRSTCHILD   0
 Position as first child.
 
#define FSPDF_BOOKMARKPOS_LASTCHILD   1
 Position as last child.
 
#define FSPDF_BOOKMARKPOS_PREVIOUS   2
 Position as previous sibling.
 
#define FSPDF_BOOKMARKPOS_NEXT   3
 Position as next sibling.
 
#define FSPDF_BOOKMARKPOS_FIRSTSIBLING   4
 Position as first sibling.
 
#define FSPDF_BOOKMARKPOS_LASTSIBLING   5
 Position as last sibling.
 

Macro Definitions for Reading Directions.

#define FSPDF_READDIRECT_L2R   0
 Reading direction from left to right.
 
#define FSPDF_READDIRECT_R2L   1
 Reading direction from right to left.
 

Macro Definitions for PDF Saving Flags

Note
These flags indicate how to save PDF document.
#define FSPDF_SAVEFLAG_INCREMENTAL   0x1
 Save PDF document incrementally. Normally, this flag should not be combined with FSPDF_SAVEFLAG_NOORIGINAL.
 
#define FSPDF_SAVEFLAG_NOORIGINAL   0x2
 Save PDF document without original data or unchanged objects.
 
#define FSPDF_SAVEFLAG_REMOVESECURITY   0x4
 Save PDF document remove security.
 
#define FSPDF_SAVEFLAG_OBJECTSTREAM   0x8
 Save PDF document by using object stream, in order to reduce the file size.
 
#define FSPDF_SAVEFLAG_OPTIMIZE   0x10
 Remove the unused objects/resources when saving the document, in order to reduce the file size. If it is combined with FSPDF_SAVEFLAG_INCREMENTAL, FSPDF_SAVEFLAG_INCREMENTAL would be ignored. Only support desktop platforms for now.
 
#define FSPDF_SAVEFLAG_INCREMENTONLY   0x20
 Save PDF document and only offer the data of increment. Normally, this flag should not be combined with any other saving flags. More...
 
#define FSPDF_SAVEFLAG_LINEARIZED   0x40
 Save PDF document with linearized. More...
 

Macro Definitions for Importing Pages Flags

Note
These flags indicate how to import pages from source document.
#define FSPDF_IMPORTFLAG_NORMAL   0x00
 Import pages normally and it equals to call function FSPDF_Doc_StartImportPages.
 
#define FSPDF_IMPORTFLAG_WITHLAYERS   0x01
 Import pages with layers and it equals to call function FSPDF_Doc_StartImportPagesWithLayers.
 
#define FSPDF_IMPORTFLAG_SHARESTREAM   0x02
 Import pages without cloning stream objects into memory and it will reduce memory overhead.
 

Detailed Description

Definitions for access to PDF document.
Definitions and functions in this module are included in fpdf_document_r.h and fpdf_document_w.h.
Module: PDFDocument
License Identifier: PDFDocument/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_document_r.h.
For License Right Writing, see fpdf_document_w.h.

This module contains following features:

Macro Definition Documentation

#define FSPDF_BOOKMARKSTATUS_EXPANDED   4

Expand bookmark.

Specify current bookmark is expanded or collapsed if it has children. It is insignificant if it is a leaf node.

#define FSPDF_SAVEFLAG_INCREMENTONLY   0x20

Save PDF document and only offer the data of increment. Normally, this flag should not be combined with any other saving flags.

If use this flag to save PDF, Foxit PDF SDK will return only the data of increment as result:

And then application should add these data to the end of source PDF to generate the final saved PDF file.

Note
#define FSPDF_SAVEFLAG_LINEARIZED   0x40

Save PDF document with linearized.

Note
This flag can only be used in function FSPDF_Doc_StartSaveToFile, and should not be used together with other saving flag.

Function Documentation

FS_RESULT FSPDF_Attachments_CountAttachment ( FSPDF_ATTACHMENTS  attachments,
FS_INT32 count 
)

Get the count of attachments.

Parameters
[in]attachmentsHandle to a FSPDF_ATTACHMENTS object returned by function FSPDF_Doc_LoadAttachments.
[out]countPointer to a FS_INT32 object that receives attachments counts. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachments or count is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • attachments: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachments_GetAttachment ( FSPDF_ATTACHMENTS  attachments,
FS_INT32  index,
FSPDF_ATTACHMENT *  attachment 
)

Get a specific attachment.

Parameters
[in]attachmentsHandle to a FSPDF_ATTACHMENTS object returned by function FSPDF_Doc_LoadAttachments.
[in]indexIndex of attachment. Range: 0 to (attachmentcount-1). attachmentcount is returned by function FSPDF_Attachments_CountAttachment.
[out]attachmentPointer to a FSPDF_ATTACHMENT handle that receives specific attachment. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachments or attachment is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of range.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • attachments: this handle is long-term recoverable.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachments_InsertAttachment ( FSPDF_ATTACHMENTS  attachments,
FS_INT32  index,
FSPDF_ATTACHMENT  attachment 
)

Insert an attachment.

Parameters
[in]attachmentsHandle to a FSPDF_ATTACHMENTS object returned by function FSPDF_Doc_LoadAttachments.
[in]indexThe index of attachment. Range: 0 to (attachementcount-1). attachementcount is returned by function FSPDF_Attachments_CountAttachment.
[in]attachmentHandle to a FSPDF_ATTACHMENT object that specifies the handle of the attachment to be inserted.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachments or attachment is a NULL pointer, or parameter index is out of range.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting attachment is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot insert attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachments: this handle is long-term recoverable.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachments_Release ( FSPDF_ATTACHMENTS  attachments)

Release a attachments object.

Parameters
[in]attachmentsHandle to a FSPDF_ATTACHMENTS object returned by function FSPDF_Doc_LoadAttachments.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachments is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • attachments: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Attachments_RemoveAttachment ( FSPDF_ATTACHMENTS  attachments,
FSPDF_ATTACHMENT  attachment 
)

Remove an attachment.

Parameters
[in]attachmentsHandle to a FSPDF_ATTACHMENTS object returned or the parameter FSPDF_Doc_LoadAttachments.
[in]attachmentHandle to a valid FSPDF_ATTACHMENT object which is a PDF attachment object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter attachments or attachment is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing attachment is not allowed.
FSCRT_ERRCODE_NOTFOUND if the function cannot find parameter attachment.
FSCRT_ERRCODE_ERROR if the function cannot remove attachment because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • attachments: this handle is long-term recoverable.
  • attachment: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_CloneIterator ( FSPDF_BOOKMARK_ITERATOR  srcIterator,
FSPDF_BOOKMARK_ITERATOR *  clonedIterator 
)

Clone an iterator to access bookmark in a document.

Parameters
[in]srcIteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a valid handle of bookmark iterator.
[out]clonedIteratorPointer to a FSPDF_BOOKMARK_ITERATOR handle that receives cloned iterator object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter srcIterator or clonedIterator is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to clone bookmark iterator because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
A cloned bookmark iterator has the same properties as source iterators, including its position.
Call function FSPDF_Bookmark_ReleaseIterator to release the clone bookmark iterator if no use.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
  • clonedIterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_CountActions ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32 count 
)

Get counts of bookmark action.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]countPointer to a FS_INT32 object that receives action counts. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or count is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_GetAction ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32  index,
FSPDF_ACTIONDATA actionData 
)

Get bookmark action.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]indexIndex of bookmark action. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Bookmark_CountActions.
[out]actionDataPointer to a FSPDF_ACTIONDATA structure that receives action data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or actionData is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of rang or no action is found.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_GetData ( FSPDF_BOOKMARK_ITERATOR  iterator,
FSPDF_BOOKMARKDATA bmData 
)

Get current bookmark iterator's data which is indicated by parameter iterator.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]bmDataPointer to a FSPDF_BOOKMARKDATA structure that receives the bookmark data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or bmData is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_GetPos ( FSPDF_BOOKMARK_ITERATOR  iterator,
FSPDF_BOOKMARKPOS *  pos 
)

Get the bookmark position handle from a bookmark iterator.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a valid handle of bookmark iterator.
[out]posPointer to a FSPDF_BOOKMARKPOS handle that receives the bookmark position object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or pos is a NULL pointer.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to get the bookmark position handle because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
  • pos: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_HasChild ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_BOOL hasChild 
)

Detect whether a bookmark iterator has a child or not.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]hasChildPointer to a FS_BOOL object that receives the state whether a bookmark itearator has child:
  • TRUE: parameter iterator has the child node
  • FALSE: parameter iterator does not have the child node.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or hasChild is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_Insert ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32  pos,
const FSPDF_BOOKMARKDATA bmData 
)

Insert a new bookmark at parameter pos bookmark position and set the data.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]posPosition where the new bookmark item is to be inserted. Please refer to macro definitions FSPDF_BOOKMARKPOS_XXX and this should be one of these macros.
[in]bmDataPointer to a FSPDF_BOOKMARKDATA structure to insert the bookmark data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or bmData is a NULL pointer, or parameter pos or bmData is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting a new bookmark is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This function inserts a new bookmark at the current position specified by parameter iterator. Parameter iterator points to the new position.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_InsertAction ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Insert bookmark action.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]indexThe index where the bookmark action to be inserted is. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Bookmark_CountActions.
If it is out of the range, parameter actionData will be inserted to the last.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be inserted.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or actionData is a NULL pointer, or actionData is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting bookmark action is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The bookmark action will be inserted to the last position if the parameter index is out of range.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_InsertAtPos ( FSPDF_BOOKMARK_ITERATOR  iterator,
FSPDF_BOOKMARKPOS  newParentPos,
FS_INT32  childIndex 
)

Insert a bookmark to be the child (with specific index) of another bookmark with specific position and old one with the specific index will be the next sibling.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object and specifies the bookmark which is to be inserted to specific position.
[in]newParentPosHandle to a FSPDF_BOOKMARKPOS object which specific the position of new parent bookmark of parameter iterator.
[in]childIndexIndex of child, which indicates where parameter iterator should be inserted under newParentPos. If this is below 0, bookmark related to iterator will be set to be the first child.
If this is above current children count of new parent bookmark, bookmark related to iterator will be set to be the last child.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or bmData is a NULL pointer, or parameter pos or bmData is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting bookmark to specific position is not allowed.
FSCRT_ERRCODE_UNKNOWNSTATE if bookmark related to parameter newParentPos is a descendant of iterator, or bookmark related to newParentPos is just iterator.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if failing to insert bookmark at specific position for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
  • Root cannot be inserted to be child of other bookmark.
  • Ancestor bookmarks cannot be inserted to be a child of their descendant bookmarks.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
  • newParentPos: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_IsFirstChild ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_BOOL isFirstChild 
)

Determine whether a bookmark iterator is the first child of its parent or not.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]isFirstChildPointer to a FS_BOOL object that receives the position state:
  • TRUE: parameter iterator points to the first child of its parent.
  • FALSE: parameter iterator does not point to the first child of its parent.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or isFirstChild is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_IsLastChild ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_BOOL isLastChild 
)

Determine whether a bookmark iterator is the last child of its parent or not.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]isLastChildPointer to a FS_BOOL object that receives the position state.
  • TRUE: parameter iterator points to the last child of its parent.
  • FALSE: parameter iterator does not point to the last child of its parent.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or isLastChild is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_IsRoot ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_BOOL isRoot 
)

Determine whether a bookmark iterator is root or not.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[out]isRootPointer to a FS_BOOL object that receives the root state:
  • TRUE: parameter iterator points to root.
  • FALSE: parameter iterator does not point to root.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or isRoot is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToFirstChild ( FSPDF_BOOKMARK_ITERATOR  iterator)

Move a bookmark iterator to its first child if existing.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter iterator has no child.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToNextSibling ( FSPDF_BOOKMARK_ITERATOR  iterator)

Move a bookmark iterator to its next sibling if existing.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter iterator has no next sibling.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToParent ( FSPDF_BOOKMARK_ITERATOR  iterator)

Move a bookmark iterator to its parent if existing.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter iterator has no parent.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToPos ( FSPDF_BOOKMARK_ITERATOR  iterator,
FSPDF_BOOKMARKPOS  newPos 
)

Move a bookmark iterator to a specific position.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]newPosHandle to a FSPDF_BOOKMARKPOS object which specific the new position to move to.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or newPosis a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter newPos pointer to an invalid position.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
  • newPos: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToPrevSibling ( FSPDF_BOOKMARK_ITERATOR  iterator)

Move a bookmark iterator to its previous sibling if existing.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the parameter iterator has no previous sibling.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_MoveToRoot ( FSPDF_BOOKMARK_ITERATOR  iterator)

Move a bookmark iterator to root.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_ReleaseIterator ( FSPDF_BOOKMARK_ITERATOR  iterator)

Release a bookmark iterator.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_ReleasePos ( FSPDF_BOOKMARKPOS  pos)

Release a bookmark position handle.

Parameters
[in]posHandle to a FSPDF_BOOKMARKPOS object which is a bookmark position object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter pos is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • pos: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_Remove ( FSPDF_BOOKMARK_ITERATOR  iterator)

Remove the current bookmark item positioned by parameter iterator.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing bookmark is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
After the current bookmark is deleted, if the current bookmark has a next sibling, parameter iterator points to this one; otherwise points to its parent.
Root cannot be deleted.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_RemoveAction ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32  index 
)

Remove a specific bookmark action.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]indexThe index of the bookmark action to be deleted. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Bookmark_CountActions.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing bookmark action is not allowed.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of rang or no action is found.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_RemoveAllActions ( FSPDF_BOOKMARK_ITERATOR  iterator)

Remove all bookmark actions.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing all actions of bookmark is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_SetAction ( FSPDF_BOOKMARK_ITERATOR  iterator,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Set bookmark action.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]indexThe index of a bookmark action. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Bookmark_CountActions.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be set.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or actionData is a NULL pointer, or actionData is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting bookmark action is not allowed.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of rang or no action is found.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_SetData ( FSPDF_BOOKMARK_ITERATOR  iterator,
const FSPDF_BOOKMARKDATA bmData 
)

Set data to current bookmark positioned by parameter iterator.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is a bookmark iterator object.
[in]bmDataPointer to a FSPDF_BOOKMARKDATA structure used to set.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator or bmData is a NULL pointer, or bmData is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting bookmark data is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Bookmark_Update ( FSPDF_BOOKMARK_ITERATOR  iterator)

Update specific bookmark iterator object after structure of bookmark tree has been changed.

Structure of bookmark tree may be changed by adding a new bookmark node , remove a existed bookmark node, or move a bookmark node to a new place. After doing these changes, the application should call this function to update bookmark iterators which are kept by application and are not used directly in these changes. If the bookmark node which is related to parameter iterator has been removed, iterator will be set to root and return value of this function will be FSCRT_ERRCODE_NOTFOUND.

Parameters
[in]iteratorHandle to a FSPDF_BOOKMARK_ITERATOR object which is to be updated.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter iterator is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or updating bookmark is not allowed.
FSCRT_ERRCODE_NOTFOUND if bookmark node which is related to parameter iterator cannot be found.
FSCRT_ERRCODE_INVALIDLICENSE if current license is not authorized or add annotation is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if the parameter iterator is root or any other error occurs.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_BookmarkData_Clear ( FSPDF_BOOKMARKDATA bmData)

Helper function to clear a bookmark data.

Parameters
[in]bmDataPointer to a FSPDF_BOOKMARKDATA structure which is a valid bookmark data object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bmData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This helper function is used to clear bookmark.
It frees FSPDF_BOOKMARKDATA::title at first and sets it to a NULL pointer, and then sets FSPDF_BOOKMARKDATA::color, FSPDF_BOOKMARKDATA::status to 0.
This function calls function FSCRT_Memory_Free to free FSPDF_BOOKMARKDATA::title.
Applications can free a FSPDF_BOOKMARKDATA structure in other ways instead of calling this function.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_BookmarkData_Init ( FSPDF_BOOKMARKDATA bmData)

Helper function to initialize a bookmark data object.

Parameters
[in]bmDataPointer to a FSPDF_BOOKMARKDATA structure which is a valid bookmark data object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter bmData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This helper function is used to initialize a bookmark data variant.
It sets FSPDF_BOOKMARKDATA::title as a NULL pointer, and sets FSPDF_BOOKMARKDATA::color, FSPDF_BOOKMARKDATA::status as 0.
Applications can initialize a FSPDF_BOOKMARKDATA structure in other ways instead of calling this function.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_ClearCache ( FSCRT_DOCUMENT  document)

Clear the cache of PDF document(temporarily only for rendering), to reduce the memory usage.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if document is NULL. FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_ERROR if failing to clear cache because of any other reason. FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is short-term.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_Close ( FSCRT_DOCUMENT  document)

Close a PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Users should not use parameter document again after it has been closed.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_CountActions ( FSCRT_DOCUMENT  document,
FS_INT32  trigger,
FS_INT32 count 
)

Get the count of document trigger actions.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]triggerAn integer value for type of trigger action of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
[out]countPointer to a FS_INT32 object that receives trigger action counts. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or count is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get count of actions because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_CountFonts ( FSCRT_DOCUMENT  document,
FS_INT32 count 
)

Count all the PDF fonts in the document, this function would enumerate all the font resources for pages, annots, and AcroForm.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]countPointer to a integer object that receives the count of fonts.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, or count is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_CountPages ( FSCRT_DOCUMENT  document,
FS_INT32 count 
)

Get page count in document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]countPointer to a FS_INT32 object that receives the count of total pages in parameter document. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or count is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get page count because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_Create ( FSCRT_DOCUMENT *  document)

Create a new document object.

Parameters
[out]documentPointer to a FSCRT_DOCUMENT handle that receives a PDF document object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating document is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot create a document because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_CreateBookmarkIterator ( FSCRT_DOCUMENT  document,
FSPDF_BOOKMARK_ITERATOR *  iterator 
)

Create an iterator to access bookmark in a document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]iteratorPointer to a FSPDF_BOOKMARK_ITERATOR handle that receives an iterator object which presents the root. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or iterator is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to create a bookmark iterator because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
When a bookmark iterator is created, its position is the root.
call function FSPDF_Bookmark_ReleaseIterator to release a bookmark iterator.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
  • iterator: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_DoJavaScriptAction ( FSCRT_DOCUMENT  document,
FS_INT32  trigger 
)

Perform the document javascript which is specified by the trigger.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a document object. It should be valid.
[in]triggerType of the trigger event. Please refer to macro definitions FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter doc is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTFOUND if no javascript in document level can be found.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to preform the document javascript because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_EmbedFont ( FSCRT_DOCUMENT  document,
FSCRT_FONT  font 
)

Embed a PDF font to the PDF document.

Currently, this function can only support to embed a non-embedded PDF font. "PDF font" here means that the font has been used for any text object in a PDF document. User should embed a font by following process:

  • 1. Create a new font and use it to a text object, or get a non-embedded font(used for text object) from PDF document.
  • 2. Embed the font. Once the font is embedded successfully, user is strongly recommended not to use the font for other text objects any more. Otherwise, unexpected result may occur when showing the text.

For other process to embed a font, this function may still run successfully, but in the saved PDF text objects may be wrong or unexpected.
Some unsupported situation:

  • If parameter font is got from another PDF document (different from parameter document), not support to embed this font to current specific PDF document.
  • If parameter font has been embedded, it cannot be embedded again.
  • If parameter font is one of the 14 standard fonts, it cannot be embedded.
Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]fontHandle to a FSCRT_FONT object, which should have been used for text objects in parameter document and has not been embedded yet.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, font is NULL.
FSCRT_ERRCODE_UNSUPPORTED parameter font has already been embedded, or does not support to be embedded.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
FSCRT_ERRCODE_ERROR if fail to create a embedded font object for other reasons.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • font: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_EnumPagesInfo ( FSCRT_DOCUMENT  document,
FSPDF_ENUMPAGEINFOHANDLER enumHandler 
)

Enumerate the information of all PDF pages.

This function is used for enumerating the information of all pages quickly. Application can get page specified information for each page from the callback function of enumHandler.
If the parameter document is loaded in asynchronous mode, application should ensure that data of document is available, and the data of all pages are available as well.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]enumHandlerPointer to a FSPDF_ENUMPAGEINFOHANDLER structure which is a page info enumeration handler. Unused callback function pointer of this handler should be set to NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not available, or page data in PDF document is not available.
FSCRT_ERRCODE_PARAM if the parameter document enumHandler is NULL, or all callback function pointers of parameter enumHandler are NULL.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there is no available data for ASYNC documents.
FSCRT_ERRCODE_ERROR if failing to enumerate info of all pages because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetAction ( FSCRT_DOCUMENT  document,
FS_INT32  trigger,
FS_INT32  index,
FSPDF_ACTIONDATA actionData 
)

Get document trigger action.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]triggerAn integer value for type of trigger action of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
[in]indexIndex of trigger actions of document. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Doc_CountActions, with same parameter trigger.
[out]actionDataPointer to a FSPDF_ACTIONDATA structure that receives trigger action data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or actionData is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of range or no action is found.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetCatalog ( FSCRT_DOCUMENT  document,
FSPDF_OBJECT *  object 
)

Get the PDF document catalog object.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object.
[out]objectPointer to a FSPDF_OBJECT handle that receives the catalog object. It should be a dictionary.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter document or object is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the catalog object is not found in the PDF document.
FSCRT_ERRCODE_INVALIDTYPE if parameter document is not a PDF document.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to catalog object is not allowed.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_ERROR if catalog object of PDF document cannot be obtained for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • object: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetDisplayMode ( FSCRT_DOCUMENT  document,
FS_INT32 displayMode 
)

Get display mode specified in PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]displayModePointer to a FS_INT32 object that receives display mode for the application. Please refer to macro definition FSPDF_DISPLAYMODE_XXX and this would be one of these macros.
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or displayMode is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get display mode because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This display mode is base mode for the application. For non full-screen display mode, call function FSPDF_ViewerPref_GetNonFullScreenPageMode to retrieve.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetEncryptDict ( FSCRT_DOCUMENT  document,
FSPDF_OBJECT *  object 
)

Get the PDF document encrypt dictionary.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object.
[out]objectPointer to a FSPDF_OBJECT handle that receives the encrypt dictionary object. It should be a dictionary.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter document or object is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if encryption dictionary is not found in the PDF document.
FSCRT_ERRCODE_INVALIDTYPE if parameter document is not a PDF document.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to the info object is not allowed.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_ERROR if encryption dictionary of PDF document cannot be obtained for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • object: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetEncryptionFilter ( FSCRT_DOCUMENT  document,
FSCRT_BSTR filter 
)

Get encryption filter value.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]filterPointer to a FSCRT_BSTR structure that receives encryption filter. It should not be NULL.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or filter is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTFOUND if the encryption filter is not found in document.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_ERROR if failing to get encryption filter because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Encryption filter is a name of the preferred security handler for PDF document.
It is common for an identity string to specify an encryption strategy, and sub-filter is subsidiary of filter for a particular implementation.
"Standard" is the filter name of the built-in password-encryption.
if the parameter filter is empty or does not have enough memory, this function will allocate memory by calling function FSCRT_BStr_SetLength.
It is better that the caller prepares enough space before calling this function if possible.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetEncryptionParam ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
FSCRT_BSTR value 
)

Get encryption parameter value.

Different encryption method will have different security dictionaries. So the value of parameter key depends on the encryption dictionary.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]keyPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
[out]valuePointer to a FSCRT_BSTR structure that receives the string data.
User should call function FSCRT_BStr_Clear to free the memory if not using it any more.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or key or value is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTFOUND if the encryption key is not found in parameter document.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_ERROR if failing to get encryption parameter value because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetEncryptionSubFilter ( FSCRT_DOCUMENT  document,
FSCRT_BSTR subFilter 
)

Get encryption sub-filter value.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]subFilterPointer to a FSCRT_BSTR structure that receives encryption sub-filter, it should not be NULL.
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or subFilter is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTFOUND if the encryption sub-filter is not found in parameter document.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_ERROR if failing to get encryption sub-filter because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
if the parameter subFilter is empty or does not have enough memory, this function will allocate memory by calling function FSCRT_BStr_SetLength.
It is better that caller prepares enough space before calling this function if possible.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetEncryptionType ( FSCRT_DOCUMENT  document,
FS_INT32 type 
)

Get current encryption type.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]typePointer to a FS_INT32 object that receives encryption type. Currently it would be one of the following macro definitions:
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or type is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetFileVersion ( FSCRT_DOCUMENT  document,
FS_INT32 version 
)

Get PDF file version stored in PDF header section.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]versionPointer to a FS_INT32 object that receives the file version, such as 14 for 1.4, 15 for 1.5, and etc. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or version is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get PDF file version because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetFontByIndex ( FSCRT_DOCUMENT  document,
FS_INT32  index,
FSCRT_FONT *  font 
)

Get the specific PDF font in the document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]indexThe index of the specific font.
[out]fontPointer to a FSCRT_FONT handle that receives the specific font.
Caller may use functions FSCRT_Font_XXX to get the basic font information or FSPDF_Font_XXX to get font information that related to PDF document. Function FSCRT_Font_Release should be called to release the font when it is not used.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, or font is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetInfoDict ( FSCRT_DOCUMENT  document,
FSPDF_OBJECT *  object 
)

Get the PDF document info object.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object.
[out]objectPointer to a FSPDF_OBJECT handle that receives the info object. It should be a dictionary.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter document or object is a NULL pointer.
FSCRT_ERRCODE_NOTFOUND if the info dictionary is not found in the PDF file.
FSCRT_ERRCODE_INVALIDTYPE if parameter document is not a PDF document.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to the info object is not allowed.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_ERROR if info object of PDF document cannot be obtained for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • object: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetJSActionByName ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR name,
FSPDF_ACTIONDATA actionData 
)

Get a document JavaScript action by its action name.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]namePointer to a FSCRT_BSTR structure to specify the name of a JavaScript action. It should be a UTF-8 string.
[out]actionDataPointer to a FSPDF_ACTIONDATA structure that receives trigger action data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or actionData is a NULL pointer, or name is invalid.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the JavaScript action is not found.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetPage ( FSCRT_DOCUMENT  document,
FS_INT32  index,
FSCRT_PAGE *  page 
)

Get a page object.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]indexIndex of PDF page. Range: 0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages.
[out]pagePointer to a FSCRT_PAGE handle that receives a page object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or page is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get a page object because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetPasswordType ( FSCRT_DOCUMENT  document,
FS_INT32 type 
)

Get current password type.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]typePointer to a FS_INT32 object that receives the password type. Currently it would be one of the following macro definitions:
If there is any error, it will be set -2.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or type is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetTrailer ( FSCRT_DOCUMENT  document,
FSPDF_OBJECT *  trailer 
)

Get the PDF document trailer dictionary.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object.
[out]trailerPointer to a FSPDF_OBJECT handle that receives the trailer dictionary. It should be a dictionary.
If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter document is NULL or trailer is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter document is not a PDF document.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access to trailer object is not allowed.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_ERROR if trailer object of PDF document cannot be obtained for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTFOUND if the trailer object is not found in the PDF document.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment; otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • object: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetUserPermissions ( FSCRT_DOCUMENT  document,
FS_DWORD permissions 
)

Get user permissions specified in PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]permissionsPointer to a FS_DWORD object that receives user permissions. Please refer to macro definition FSPDF_PERMISSION_XXX and this would be one or a combination of these macros.
If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or permissions is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Permissions are only applied to a common viewer. Owner has full permissions to a PDF document.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetWrapperData ( FSCRT_DOCUMENT  document,
FSPDF_WRAPPERDATA wrapperData 
)

Get wrapper data.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]wrapperDataPointer to a FSPDF_WRAPPERDATA structure that receives wrapper data.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or wrapperData is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type or is not a wrapper file.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_NOTFOUND if the parameter document is not a wrapper document.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get wrapper data because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
PDF wrapper is an extended standard, it helps to hint some information to viewers.
PDF wrapper consists of wrapper type which is an identity string, wrapper offset which tells the end of original data
and wrapper template which is the content of wrapper document. They are specified while calling function FSPDF_Doc_SaveAsWrapperFile.
Application can determine whether to support current wrapper document based on this wrapper data.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_GetWrapperOffset ( FSCRT_DOCUMENT  document,
FSCRT_FILESIZE offset 
)

Get wrapper offset.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]offsetPointer to a FSCRT_FILESIZE structure that receives wrapper offset. In order to keep forward compatibilities, use 64-bits here.
If there is any error, the value of FSCRT_FILESIZE will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or offset is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTFOUND if the parameter document is not a wrapper document.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get wrapper offset because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
PDF wrapper is an extended standard, it helps to hint some information to viewers.
PDF wrapper consists of wrapper type which is an identity string, of wrapper offset which tells the end of original data,
and of wrapper template which is the content of wrapper document. They are specified while calling function FSPDF_Doc_SaveAsWrapperFile.
Application can access original PDF contents by wrapper offset.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_InitiateJavaScript ( FSCRT_DOCUMENT  document)

Perform the document javascript when document is opened, defining JavaScript functions for use by other scripts in the document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a document object. It should be valid.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_UNKNOWNSTATE if the form module is not loaded. FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if failing to initialize JavaScript because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_InsertAction ( FSCRT_DOCUMENT  document,
FS_INT32  trigger,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Insert document trigger action.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]triggerAn integer value for trigger actions of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
[in]indexThe index of trigger actions of document. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Doc_CountActions.
If it is out of the range, parameter actionData will be inserted to the last.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be inserted.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or actionData is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to insert action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The document action will be inserted to the last position, if the parameter index is out of range.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_IsModified ( FSCRT_DOCUMENT  document,
FS_BOOL isModified 
)

Get PDF document modify mark.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]isModifiedPointer to a FS_BOOL object that receives the modify mark. If there is any error, it will be set FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or modifyMark is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get modify mark because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_IsPortfolio ( FSCRT_DOCUMENT  document,
FS_BOOL isPortfolio 
)

Whether a document is a portfolio file or not.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]isPortfolioPointer to a FS_BOOL object that receives the boolean value which indicates whether the file is portfolio or not.
If there is any error, it will be set FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isPortfolio is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get portfolio mark because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_IsWrapper ( FSCRT_DOCUMENT  document,
FS_BOOL isWrapper 
)

Determine whether the document is a wrapper document or not.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]isWrapperPointer to a FS_BOOL object that receives wrapper state.:
  • TRUE: parameter document is a wrapper.
  • FALSE: parameter document is not a wrapper.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isWrapper is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get the boolean value because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
PDF wrapper is an extended standard. It helps to hint some information to viewers.
PDF wrapper consists of wrapper type which is an identity string, wrapper offset which tells the end of original data, and wrapper template which is the content of wrapper document.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_LoadAttachments ( FSCRT_DOCUMENT  document,
FSPDF_ATTACHMENTS *  attachments 
)

Load all attachments of PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]attachmentsPointer to a FSPDF_ATTACHMENTS handle that receives an attachments object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or attachments is a NULL pointer.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if cannot load attachments because of any other reasons.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • attachments: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_PageIndexToPageLabel ( FSCRT_DOCUMENT  document,
FS_INT32  pageIndex,
FSCRT_BSTR pageLabel 
)

Convert a page index to page label.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]pageIndexThe index of page. Range: 0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages.
[out]pageLabelPointer to a FSCRT_BSTR structure that receives page label string. It will be in UTF-8 format If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or pageLabel is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter pageIndex is out of range.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
if the parameter pageLabel is empty or doens't have enough memory, this function will allocate memory by calling function FSCRT_BStr_SetLength.
It is better for callers to prepare enough memory before calling this function.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_PageLabelToPageIndex ( FSCRT_DOCUMENT  document,
FS_BOOL  noCase,
const FSCRT_BSTR pageLabel,
FS_INT32 pageIndex 
)

Convert a page label to page index.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]noCaseA FS_BOOL value which indicates to use case-insensitive when its value is TRUE, or to use case-sensitive when its value is FALSE.
[in]pageLabelPointer to a FSCRT_BSTR structure which is a page label. It should be a valid UTF-8 string.
[out]pageIndexPointer to a FS_INT32 object that receives the page index corresponding to parameter pageLabel. If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, pageLabel or pageIndex is a NULL pointer, or pageLabel is empty.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter pageLabel cannot match to a page.
FSCRT_ERRCODE_FORMAT if the parameter pageLabel is not in UTF-8 format.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to convert a page label to page index because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_RemoveAction ( FSCRT_DOCUMENT  document,
FS_INT32  trigger,
FS_INT32  index 
)

Remove document trigger action.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]triggerAn integer value for trigger actions of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
[in]indexThe index of trigger actions of document. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Doc_CountActions.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of range or no action is found.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to remove action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_RemoveAllActions ( FSCRT_DOCUMENT  document,
FS_INT32  trigger 
)

Remove all document trigger action.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]triggerAn integer value for trigger actions of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing all actions is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to remove all actions because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_RemoveJSActionByName ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR name 
)

Remove a javascript action from the PDF document by the name of javascript action.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]namePointer to a FSCRT_BSTR structure to specify the name of a JavaScript action. It should be a UTF-8 string.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or name is a NULL pointer or empty.
FSCRT_ERRCODE_FORMAT if parameter name is not in UTF-8 format.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter name is not a javascript action name.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to remove action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_SaveAsWrapperFile ( FSCRT_DOCUMENT  wrapperDoc,
FSCRT_FILE  file,
const FSPDF_WRAPPERDATA wrapperData,
FS_DWORD  userPermissions,
const FSCRT_BSTR ownerPassword 
)

Save a 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 parameter file to set wrapper offset.

Parameters
[in]wrapperDocHandle to a FSCRT_DOCUMENT object which is a wrapper document. This function save parameter wrapperDoc as wrapper by the end of file.
[in]fileHandle to a FSCRT_FILE object. Parameter wrapperDoc will be saved into it.
[in]wrapperDataPointer to a FSPDF_WRAPPERDATA structure which contains wrapper data. If it is NULL, no wrapper data is used.
[in]userPermissionsUser permissions for the wrapper document. Pass 0xFFFFFFFC if it needs no special permissions. Please refer to macro definitions FSPDF_PERMISSION_XXX and this can be one or a combination of these macros.
[in]ownerPasswordPointer to a FSCRT_BSTR structure which is owner password. If it is NULL, parameter userPermissions is ignored.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameters wrapperDoc or file is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or saving as wrapper file is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter wrapperDoc is not a valid PDF document type.
FSCRT_ERRCODE_FILE if the function cannot output data into file.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter wrapperDoc is not ready when wrapperDoc is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to save as wrapper file because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
  • Parameter file should have WRITE callback functions implemented in FSCRT_FILEHANDLER if it is created based on a FSCRT_FILEHANDLER object.
  • Before saving PDF document, we suggest customer to update the "ModDate" by calling function FSPDF_Metadata_SetDateTime, especially when the document has been modified.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • wrapperDoc: this handle is long-term partially recoverable.
  • file: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_SetAction ( FSCRT_DOCUMENT  document,
FS_INT32  trigger,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Set document trigger action.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]triggerAn integer value for trigger actions of document. Please refer to macro definition FSPDF_TRIGGER_DOC_XXX and this should be one of these macros.
[in]indexThe index of trigger actions of document. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Doc_CountActions.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure used to set.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or actionData is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter index is out of range or no action is found.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set action because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_SetDisplayMode ( FSCRT_DOCUMENT  document,
FS_INT32  displayMode 
)

Set display mode specified in PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]displayModePlease refer to macro definition FSPDF_DISPLAYMODE_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or displayMode is not one of macros FSPDF_DISPLAYMODE_XXX.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get display mode because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_SetFileVersion ( FSCRT_DOCUMENT  document,
FS_INT32  version 
)

Specify the PDF file version which will be stored in PDF header section. This function does not check whether the PDF matches the specified version.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]versionAn integer specify the file version, such as 14 for 1.4, 15 for 1.5, and etc. Its value should be between 10 and 17, If it is out of range, then it would be reset as the closest version (10 or 17).
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_ERROR if failing to set PDF file version because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_SetJavaScriptActionHandler ( FSCRT_DOCUMENT  document,
FSPDF_JAVASCRIPTACTION_HANDLER actionHandler 
)

Set the action handler to the PDF document.

Note
Some interaction features such as performing JavaScript actions or filling the form, would require caller to implement the callback functions of action handler, in order to function well.
Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]actionHandlerPointer to a FSPDF_JAVASCRIPTACTION_HANDLER structure.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or actionHandler is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_HANDLER if FSPDF_JAVASCRIPTACTION_HANDLER::InvalidateRect of parameter actionHandler is NULL
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartImportPages ( FSCRT_DOCUMENT  dstDoc,
FS_INT32  startIndex,
FSCRT_DOCUMENT  srcDoc,
const FS_INT32 pageRanges,
FS_INT32  count,
FSCRT_PROGRESS *  importProgress 
)

To start a progressive process of inserting a range of pages from a extra source document into the target document.

It will take a long time to complete this process with large range of pages, so Foxit PDF SDK uses a progressive process to do this.
Caller should pass importProgress to function FSCRT_Progress_Continue to continue processing in steps, and should call function FSCRT_Progress_Release to destroy importProgress object if importing process is over.

Parameters
[in]dstDocHandle to a FSCRT_DOCUMENT object which specifies the destination PDF document handle.
[in]startIndexA page index in parameter dstDoc where the imported pages will be inserted. Range: 0 to pagecount. pagecount is returned by function FSPDF_Doc_CountPages. If it equals to pagecount, it means the imported page will be added to the end of destination PDF document.
[in]srcDocHandle to a FSCRT_DOCUMENT object which specifies the source PDF document handle.
[in]pageRangesPointer to a FS_INT32 object which specifies a array to record the page ranges to be imported.
In this array, 2 numbers are a pair: the first integer is the starting page number, and the second integer is the page count.
If this parameter to be set NULL pointer, it means importing the whole source document.
[in]countAn integer value which indicates the count of elements in parameter pageRanges. It should be an even number when pageRanges is not NULL.
[out]importProgressPointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter dstDoc or srcDoc or importProgress is a NULL pointer, or count is not an even number when pageRanges is not NULL.
FSCRT_ERRCODE_UNSUPPORTED if the parameter srcDoc has an XFA form.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or importing page is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter dstDoc or srcDoc is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter startIndex is out of range.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter dstDoc or srcDoc is not ready when dstDoc or srcDoc is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot import pages because of any other reason.
FSCRT_ERRCODE_NOTPARSED if the parameter srcDoc has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
If the user calls this function and then calls function FSPDF_Doc_StartSaveToFile to save PDF file, the saving flag will be converted to FSPDF_SAVEFLAG_NOORIGINAL.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • dstDoc: this handle is long-term partially recoverable.
  • srcDoc: this handle is long-term partially recoverable.
  • importProgress: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartImportPagesFromFileName ( FSCRT_DOCUMENT  dstDoc,
FS_INT32  startIndex,
const FSCRT_BSTR srcFileName,
const FSCRT_BSTR password,
const FSCRT_BSTR layerName,
const FS_INT32 pageRanges,
FS_INT32  count,
FS_INT32  flags,
FSCRT_PROGRESS *  importProgress 
)

To start a progressive process of inserting a range of pages from an extra source document which specified by file path to the target document.

It will take a long time to complete this process with large range of pages, so Foxit PDF SDK uses a progressive process to do this.
Callers should pass importProgress to function FSCRT_Progress_Continue to continue processing in steps, and should call function FSCRT_Progress_Release to destroy importProgress object if importing process is over. If callers want to reduce memory usage during importing, flags should be with FSPDF_IMPORTFLAG_SHARESTREAM, howerver, it may reduce the performance a little bit. The files specified by srcFileName cannot be removed unless dstDoc is closed.

Parameters
[in]dstDocHandle to a FSCRT_DOCUMENT object which specifies the destination PDF document handle.
[in]startIndexA page index in parameter dstDoc where the imported pages will be inserted. Range: 0 to pagecount. pagecount is returned by function FSPDF_Doc_CountPages. If it equals to pagecount, it means the imported page will be added to the end of destination PDF document.
[in]srcFileNamePointer to a UTF-8 encoded string which specifies the source file name. It should be a valid pointer to a FSCRT_BSTR structure.
[in]passwordPointer to a FSCRT_BSTR structure which specifies a password to the srcFileName. It can be user password or owner password. If no password is used, please pass NULL or empty string directly.
[in]layerNamePointer to a FSCRT_BSTR structure. If all content of source document is imported, the layer name in the OCProperties dictionary would be same with layerName. Otherwise, layerName would be the prefix name of the layer name in the OCProperties dictionary. It only works with FSPDF_IMPORTFLAG_WITHLAYERS and it should be NULL without this flag.
[in]pageRangesPointer to a FS_INT32 object which specifies a array to record the page ranges to be imported.
In this array, 2 numbers are a pair: the first integer is the starting page index, and the second integer is the page count.
If this parameter is set to NULL, all pages in the source document will be imported.
[in]countAn integer value which indicates the count of elements in parameter pageRanges. It should be an even number when pageRanges is not NULL.
[in]flagsIndicate the importing options. Please refer to macro definitions FSPDF_IMPORTPAGES_XXX and this can be one or a combination of these macros.
[out]importProgressPointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameters meet the following conditions:
  • parameter dstDoc, srcFileName, pageRanges or importProgress is NULL.
  • parameter srcFileName is an empty string or the file specified by srcFileName cannot be opened.
  • parameter flags is not supported.
  • if parameter flags is with FSPDF_IMPORTFLAG_WITHLAYERS and layerName is NULL.
  • if parameter flags is without FSPDF_IMPORTFLAG_WITHLAYERS and layerName is not NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or importing page with layer is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter dstDoc is not a valid PDF document type.
FSCRT_ERRCODE_UNSUPPORTED if the source document has an XFA form.
FSCRT_ERRCODE_FORMAT if the parameter srcFileName is not in UTF-8 format or the file specified by srcFileName is not a PDF document..
FSCRT_ERRCODE_NOTFOUND if the parameter startIndex or pageRanges is out of range.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter dstDoc is not ready when dstDoc is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot import pages because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
If the user calls this function and then calls function FSPDF_Doc_StartSaveToFile to save PDF file, the saving flag will be converted to FSPDF_SAVEFLAG_NOORIGINAL.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • dstDoc: this handle is long-term partially recoverable.
  • importProgress: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartImportPagesWithLayers ( FSCRT_DOCUMENT  dstDoc,
FS_INT32  startIndex,
FSCRT_DOCUMENT  srcDoc,
const FSCRT_BSTR layerName,
const FS_INT32 pageRanges,
FS_INT32  count,
FSCRT_PROGRESS *  importProgress 
)

To start a progressive process of inserting a range of pages from a extra source document with its layer information into the target document.

It will take a long time to complete this process with large range of pages, so Foxit PDF SDK uses a progressive process to do this.
Caller should pass importProgress to function FSCRT_Progress_Continue to continue processing in steps, and should call function FSCRT_Progress_Release to destroy importProgress object if importing process is over.

Parameters
[in]dstDocHandle to a FSCRT_DOCUMENT object which specifies the destination PDF document handle.
[in]startIndexA page index in parameter dstDoc where the imported pages will be inserted. Range: 0 to pagecount. pagecount is returned by function FSPDF_Doc_CountPages. If it equals to pagecount, it means the imported page will be added to the end of destination PDF document.
[in]srcDocHandle to a FSCRT_DOCUMENT object which specifies the source PDF document handle.
[in]layerNamePointer to a FSCRT_BSTR structure. If all content of source document is imported, the layer name in the OCProperties dictionary would be same with layerName. Otherwise, layerName would be the prefix name of the layer name in the OCProperties dictionary.
[in]pageRangesPointer to a FS_INT32 object which specifies a array to record the page ranges to be imported.
In this array, 2 numbers are a pair: the first integer is the starting page number, and the second integer is the page count.
If this parameter to be set NULL pointer, it means importing the whole source document.
[in]countAn integer value which indicates the count of elements in parameter pageRanges. It should be an even number when pageRanges is not NULL.
[out]importProgressPointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter dstDoc or srcDoc or srcDocName or importProgress is a NULL pointer, or count is not an even number when pageRanges is not NULL.
FSCRT_ERRCODE_UNSUPPORTED if the parameter srcDoc has an XFA form.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or importing page with layer is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter dstDoc or srcDoc is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter startIndex is out of range.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter dstDoc or srcDoc is not ready when dstDoc or srcDoc is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot import pages with layers because of any other reason.
FSCRT_ERRCODE_NOTPARSED if the parameter srcDoc has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
If the user calls this function and then calls function FSPDF_Doc_StartSaveToFile to save PDF file, the saving flag will be converted to FSPDF_SAVEFLAG_NOORIGINAL.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • dstDoc: this handle is long-term partially recoverable.
  • srcDoc: this handle is long-term partially recoverable.
  • importProgress: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartLoad ( FSCRT_FILE  file,
const FSCRT_BSTR password,
FSCRT_DOCUMENT *  document,
FSCRT_PROGRESS *  progress 
)

Load a PDF file.

Parameters
[in]fileHandle to a FSCRT_FILE object which is a file object to be loaded.
[in]passwordPointer to a FSCRT_BSTR structure which specifies a password. It can be user password or owner password. If no password is used, pass NULL or empty string directly.
[out]documentPointer to a FSCRT_DOCUMENT handle that receives the PDF document. If there is any error, it will be NULL.
[out]progressReserved, currently it will be NULL. Pointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter file or document is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access PDF document is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_FORMAT if the parameter file is not a PDF file.
FSCRT_ERRCODE_FILE if the function cannot read data from the parameter file.
FSCRT_ERRCODE_UNKNOWNSECURITYHANDLER if there is an unknown security handler.
FSCRT_ERRCODE_PASSWORD if the parameter password is wrong.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to load a PDF file because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
If applications only view PDF, only READ callback functions in FSCRT_FILEHANDLER needs to be implemented.
If applications need to change PDF contents or save PDF files, WRITE callback functions should be implemented.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • file: this handle is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartLoadWithFlag ( FSCRT_FILE  file,
const FSCRT_BSTR password,
FS_DWORD  flag,
FSCRT_DOCUMENT *  document,
FSCRT_PROGRESS *  progress 
)

Load a PDF file with the extra flags.

Note
If application want to use default option, please call FSPDF_Doc_StartLoad, or set flag to 0.
Parameters
[in]fileHandle to a FSCRT_FILE object which is a file object to be loaded.
[in]passwordPointer to a FSCRT_BSTR structure which specifies a password. It can be user password or owner password. If no password is used, pass NULL or empty string directly.
[in]flagIndicate the loading options. Please refer to macro definitions FSPDF_LOADFLAG_XXX and this should be one of these macros.
[out]documentPointer to a FSCRT_DOCUMENT handle that receives the PDF document. If there is any error, it will be NULL.
[out]progressReserved, currently it will be NULL. Pointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter file or document is a NULL pointer or flag is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or access PDF document is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_FORMAT if the parameter file is not a PDF file.
FSCRT_ERRCODE_FILE if the function cannot read data from the parameter file.
FSCRT_ERRCODE_UNKNOWNSECURITYHANDLER if there is an unknown security handler.
FSCRT_ERRCODE_PASSWORD if the parameter password is wrong.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to load a PDF file because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
If applications only view PDF, only READ callback functions in FSCRT_FILEHANDLER needs to be implemented.
If applications need to change PDF contents or save PDF files, WRITE callback functions should be implemented.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • file: this handle is long-term recoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartReLoad ( FSCRT_DOCUMENT  document,
FSCRT_FILE  file,
const FSCRT_BSTR password,
FSCRT_PROGRESS *  progress 
)

Reload PDF file.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]fileHandle to a FSCRT_FILE object which is a file object to be reloaded. It should be the same FSCRT_FILE object with parameter file passed to function FSPDF_Doc_StartLoad or FSPDF_Doc_StartLoadWithFlag.
[in]passwordPointer to a FSCRT_BSTR structure which specifies a password. It can be user password or owner password. If no password is used, pass NULL or empty string directly.
[out]progressReserved, currently it will be NULL. Pointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or file is a NULL pointer.
FSCRT_ERRCODE_INVALIDMODULE if PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid type of PDF document.
FSCRT_ERRCODE_FORMAT if the parameter file is not a PDF file.
FSCRT_ERRCODE_FILE if the function cannot read data from the parameter file.
FSCRT_ERRCODE_PASSWORD if the parameter password is wrong.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if failing to reload a PDF file because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Please refer to the note in function FSPDF_Doc_StartLoad.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • file: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Doc_StartSaveToFile ( FSCRT_DOCUMENT  document,
FSCRT_FILE  file,
FS_INT32  flag,
FSCRT_PROGRESS *  saveProgress 
)

Start saving a PDF document to another file in a progressive manner.

It will take a long time to save a document with complex or large content, so Foxit PDF SDK uses a progressive process to do this.
Caller should pass parameter saveProgress to function FSCRT_Progress_Continue to continue saving progressively, and should call function FSCRT_Progress_Release to destroy parameter saveProgress if the saving process is over.
To change the saved file version, the user can call function FSCRT_Progress_SetProperty to set "fileversion".
And the type of parameter values in function FSCRT_Progress_SetProperty must be FSCRT_VT_INT32.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]fileHandle to a FSCRT_FILE object which specifies another file used to save current PDF document object document.
[in]flagAn integer value to specify saving mode. Please refer to macro definitions FSPDF_SAVEFLAG_XXX and this can be one or a combination of these macros.
[out]saveProgressPointer to a FSCRT_PROGRESS handle that receives progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if any of three parameters document, file or saveProgress is a NULL pointer, or parameter flag is invalid, or parameter flag combines FSPDF_SAVEFLAG_LINEARIZED and other saving flag.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or saving file is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by functoion FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if the function cannot save document because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • file: this handle is long-term recoverable.
  • saveProgress: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_GetDateTime ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
FSCRT_DATETIMEZONE dt 
)

Get a date and time value from metadata.

Metadata provides some application level information about document, such as author, title, creation time and others.
There are two ways to store these information in PDF file:

  • in "Info" dictionary in trail dictionary.
  • in metadata stream (with XML format) in the "Catalog" dictionary.

Which information would be got depends on the information of modified date, which is defined in key "ModDate" in the "Info" dictionary and "MetadataDate" in XML.
This function will get the latest modified date time between these two ways.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]keyPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "CreationDate"
  • "ModDate"
[out]dtPointer to a FSCRT_DATETIMEZONE structure that receives a date and time value associated to parameters key.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or key or dt is a NULL pointer, or key is empty.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter key is not found in dictionary document does not have metadata information.
FSCRT_ERRCODE_FORMAT if the data and time at parameter key position is empty or is not a valid format.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_GetString ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
FSCRT_BSTR string 
)

Get a UTF-8 string value from metadata.

Metadata provides some application level information about document, such as author, title, creation time and others.
There are two ways to store these information in PDF file:

  • in "Info" dictionary in trail dictionary.
  • in metadata stream (with XML format) in the "Catalog" dictionary.

Which information would be got depends on the information of modified date, which is defined in key "ModDate" in the "Info" dictionary and "MetadataDate" in XML.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]keyPointer to a UTF-8 key string, and it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following macro definitions:
  • "Title"
  • "Author"
  • "Subject"
  • "Keywords"
  • "Creator"
  • "Producer"
  • "Trapped"
  • "pdfaid"
[out]stringPointer to a FSCRT_BSTR structure that receives a UTF-8 string value associated to parameter key. If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, key or string is a NULL pointer, or key is empty.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter key is not found in metadata or document does not have metadata information.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
if the parameter string is empty or does not have enough memory, this function will allocate memory by calling function FSCRT_BStr_SetLength.
It is better for caller to prepare enough memory before calling this function.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_GetStringArray ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
FSCRT_ARRAY stringArray 
)

Get an UTF-8 string array value from metadata.

Metadata provides some application level information about document, such as author, title, creation time and others.
There are two ways to store these information in PDF file:

  • in "Info" dictionary in trail dictionary.
  • in metadata stream (with XML format) in the "Catalog" dictionary.

Which information would be got depends on the information of modified date, which is defined in key "ModDate" in the "Info" dictionary and "MetadataDate" in XML.
There could be multiple string values associated with the same key,so the result is received as an array.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object.It should be valid.
[in]keyPointer to a UTF-8 key string, and it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following macro definitions:
  • "Title"
  • "Author"
  • "Subject"
  • "Keywords"
  • "Creator"
  • "Producer"
  • "Trapped"
  • "pdfaid"
[out]stringArrayPointer to a FSCRT_ARRAY structure that receives an UTF-8 string array value associated to parameter key. Application should call function FSCRT_Array_Init to initialize it and FSCRT_Array_Clear to release it. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, key, or stringArray is a NULL pointer, stringArray::dataType is not FSCRT_VT_BSTR, or key is empty.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter key is not found in metadata or document does not have metadata information.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_SetDateTime ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
const FSCRT_DATETIMEZONE dt 
)

Set a date value to parameter key in metadata.

Metadata provides some application level information to tell the viewer document properties, such as author, title, creation time and others.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]keyPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "CreationDate"
  • "ModDate"
  • Some other custom information keys, if they're supported by the PDF file.
[in]dtPointer to a FSCRT_DATETIMEZONE structure which is a date and time value associated to parameter key.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, key or dt is a NULL pointer, or key is empty, or parameter dt is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting date value is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set date value because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_SetString ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
const FSCRT_BSTR string 
)

Set a UTF-8 string value to parameter key in metadata.

Metadata provides some application level information to tell a viewer something about this document, such as author, title, creation time and others.
If the key is "Keywords" or "Author" and string contains ';', ',' or any other separators identified by Adobe, the string would be surrounded with double quotes.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]keyPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "Title"
  • "Author"
  • "Subject"
  • "Keywords"
  • "Creator"
  • "Producer"
  • "Trapped"
  • "pdfaid"
  • Some other custom information keys, if they're supported by the PDF file.
[in]stringPointer to a metadata UTF-8 string, associated to parameter key, it should be a valid pointer to FSCRT_BSTR structure.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or key or string is a NULL pointer, or key is empty.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting metadata string is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set metadata string because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Metadata_SetStringArray ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR key,
const FSCRT_BSTR stringArray,
const FS_INT32  count 
)

Set an UTF-8 string array value to parameter key in metadata.

Metadata provides some application level information to tell a viewer something about this document, such as author, title, creation time and others. The information exists in two ways: "info" dictionary in trail and metadata stream in the format of XML in the "catalog" dictionary. The information in the XML metadata stream could be format of array, this function is used to set array value. The function is compatible with the function:: FSPDF_Metadata_SetString and would both set information in two places if the key is compatible. If the key is "Keywords" or "Author" and the string in stringArray contains ';', ',' or any other separators identified by Adobe, the string would be surrounded with double quotes.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]keyPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "Title"
  • "Author"
  • "Subject"
  • "Keywords"
  • "Creator"
  • "Producer"
  • "Trapped"
  • "pdfaid"
  • Some other custom information keys, if they're supported by the PDF file.
[in]stringArrayPointer to an UTF-8 string array. Elements in this are metadata information, which is associated to parameter key. Each element in this array should be an object of FSCRT_BSTR structure.
[in]countThe count of elements in parameter stringArray.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or key or stringArray is a NULL pointer, or key is empty, or count is less than or equal to zero. FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting metadata string is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set metadata string because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_PageLabels_CountRanges ( FSCRT_DOCUMENT  document,
FS_INT32 count 
)

Get count of ranges of page labels which use different numbering systems.

For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]countPointer to a FS_INT32 object that receives count of labeling ranges. If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or count is NULL.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_PageLabels_GetRangeInfo ( FSCRT_DOCUMENT  document,
FS_INT32  rangeIndex,
FS_INT32 start,
FS_INT32 style,
FSCRT_BSTR prefix,
FS_INT32 st 
)

Get information of page labels by a specified range.

For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system. The numbering system consists of some information of page labels.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]rangeIndexThe index of the current labeling range. Valid value is from 0 to (count - 1). count is returned by function FSPDF_PageLabels_CountRanges.
[out]startPointer to a FS_INT32 object that receives the index of first page in the current range. If there is any error, it will be set -1.
[out]stylePointer to a FS_INT32 object that receives the numbering style to be used for the numeric portion of each page label. Please refer to macro definitions FSPDF_PAGELABEL_STYLE_XXX and it would be one of these macros. If the value is FSPDF_PAGELABEL_STYLE_None, page labels consist solely of a label prefix with no numeric portion. If there is any error, it will be set -1.
[out]prefixPointer to a FSCRT_BSTR structure that receives a label prefix for page labels in the current range. It will be in UTF-8 format. If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function.
[out]stPointer to a FS_INT32 object that receives the value of the numeric portion for the first page label in the current range. Subsequent pages are numbered sequentially from this value, which must be greater than or equal to 1. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or start or style or prefix or st is NULL.
FSCRT_ERRCODE_NOTFOUND if the parameter rangeIndex is out of range, or no page labels exist.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_PageLabels_RemoveAll ( FSCRT_DOCUMENT  document)

Delete all page labels in the PDF document.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_PageLabels_SetRangeInfo ( FSCRT_DOCUMENT  document,
FS_INT32  start,
FS_INT32  style,
const FSCRT_BSTR prefix,
FS_INT32  st 
)

Set page labels of PDF pages with a specified range.

For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system. Pages within a range are numbered sequentially in ascending order. Page labels are consecutively until a next new range.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]startThe index of first page in the current range. Valid value is from 0 to (count - 1). count is returned by function FSPDF_Doc_CountPages.
[in]styleAn integer value which is a numbering style to be used for the numeric portion of each page label. Please refer to macro definitions FSPDF_PAGELABEL_STYLE_XXX and this should be one of these macros. If the value is FSPDF_PAGELABEL_STYLE_None, page labels consist solely of a label prefix with no numeric portion.
[in]prefixPointer to a FSCRT_BSTR structure which is a label prefix for page labels in the current range. It should be a valid UTF-8 string. If it is NULL or prefix->str is NULL or prefix->len is less than 1, it means no label prefix.
[in]stAn integer value which is the numeric portion for the first page label in the current range. Subsequent pages are numbered sequentially from this value, which must be greater than or equal to 1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL, or style or st is invalid.
FSCRT_ERRCODE_NOTFOUND if the parameter start is out of range.
FSCRT_ERRCODE_FORMAT if the parameter prefix is not in UTF-8 format.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetAreaType ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR boxItem,
FS_INT32 boxType 
)

Get the type of area item from viewer preferences.

Viewer preferences defines the way that a document is to be presented on the screen or in print.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]boxItemPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "ViewArea"
  • "ViewClip"
  • "PrintArea"
  • "PrintClip"
[out]boxTypePointer to a FS_INT32 object that receives the page box type. Please refer to macro definitions FSPDF_PAGEBOX_XXX and this would be one of these macros.
Default: FSPDF_PAGEBOX_CROPBOX
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or boxItem or boxType is a NULL pointer, or boxItem is empty or invalid.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter boxItem is not found in viewer preferences.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get area type because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetNonFullScreenPageMode ( FSCRT_DOCUMENT  document,
FS_INT32 displayMode 
)

Get display mode for non full-screen mode from viewer preferences.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]displayModePointer to a FS_INT32 object to get display mode. It would be one of the following macro definitions:
Default: FSPDF_DISPLAYMODE_USENONE
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or displayMode is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get display mode for non full-screen because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
For normal document display mode, call function FSPDF_Doc_GetDisplayMode to retrieve.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetPrintCopies ( FSCRT_DOCUMENT  document,
FS_INT32 copies 
)

Get the number of copies to be printed.

Viewer preferences defines the way that a document is to be presented on the screen or in print.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]copiesPointer to a FS_INT32 object that receives the number of copies to be printed when the print dialogue is opened for this file.
Supported values are the integers 2 through 5. Values outside this range are ignored. Default value: as defined by PDF viewer application, but typically 1. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or copies is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get print copies because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetPrintRanges ( FSCRT_DOCUMENT  document,
FS_INT32 pageRanges,
FS_INT32 count 
)

Get page ranges which allowed to print.

Viewer preferences defines the way that a document is to be presented on the screen or in print.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]pageRangesPointer to a FS_INT32 object array that receives the page ranges to be printed. In this array, 2 numbers are a pair: the first integer is the starting page number, and the second integer is the last page number. The first page of the PDF file is denoted by 1
If it is NULL, parameter count receives total count of elements of all page ranges.
[out]countPointer to a FS_INT32 object that receives the count of elements in parameter pageRanges.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or count is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if document does not have viewer preferences or viewer preferences does not have entry "PrintPageRange".
FSCRT_ERRCODE_BUFFEROVERFLOW if the parameter pageRanges is valid but count is less than required amount.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get print ranges because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Commonly, this function is called twice, pass NULL to parameter pageRanges at first to retrieve the count of page ranges, and call it again when pageRanges contains enough space. Parameter count should never be empty.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetPrintScale ( FSCRT_DOCUMENT  document,
FSCRT_BSTR printScale 
)

Get page scaling option from viewer preferences.

Viewer preferences defines the way that a document is to be presented on the screen or in print.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]printScalePointer to a FSCRT_BSTR structure that receives a UTF-8 string value which specifies page scale. It would be one of following:
  • "None": the print dialogue should reflect no page scaling.
  • "AppDefault": applications should use the current print scaling.
  • Other: applications should use the current print scaling.
Default: "AppDefault"
If there is any error, FSCRT_BSTR::str will be set empty if it is not NULL while calling this function, and FSCRT_BSTR::len will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or printScale is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get print scale because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetReadingDirection ( FSCRT_DOCUMENT  document,
FS_INT32 direction 
)

Get reading direction from viewer preferences.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]directionPointer to a FS_INT32 object that receives reading direction:
Default: FSPDF_READDIRECT_L2R
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or direction is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get reading direction because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_GetUIVisibility ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR uiItem,
FS_BOOL uiVisible 
)

Get UI visibility status from viewer preferences.

Viewer preferences defines the way that a document is to be presented on the screen or in print.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[in]uiItemPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "HideToolbar"
  • "HideMenubar"
  • "HideWindowUI"
  • "FitWindow"
  • "CenterWindow"
  • "DisplayDocTitle"
  • Some other custom UI item keys, if they're supported by PDF.
[out]uiVisiblePointer to a FS_BOOL object that receives a boolean value. Default: FALSE
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or uiItem or uiVisible is a NULL pointer, or uiItem is empty.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_NOTFOUND if the parameter uiItem is not found in viewer preferences.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_DATANOTREADY if there are not available data for ASYNC documents.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to get UI visibility status because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetAreaType ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR boxItem,
FS_INT32  boxType 
)

Set the page box type in viewer preferences.

Viewer preferences define the way that a document is to be presented on the screen or for printing.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]boxItemPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "ViewArea"
  • "ViewClip"
  • "PrintArea"
  • "PrintClip"
[in]boxTypeAn integer value which specifies a page box type. Please refer to macro definitions FSPDF_PAGEBOX_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or boxItem is a NULL pointer, or boxItem is empty or invalid, or boxType is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting box type is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set area type because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetNonFullScreenPageMode ( FSCRT_DOCUMENT  document,
FS_INT32  displayMode 
)

Set display mode for non full-screen mode in viewer preferences.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]displayModePointer to a FS_INT32 object to indicate display mode. It should be one of the following macro definitions:
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or displayMode is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting display mode is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set display mode for non full-screen mode because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetPrintCopies ( FSCRT_DOCUMENT  document,
FS_INT32  copies 
)

Set the number of copies to be printed.

Viewer preferences define the way that a document is to be presented on the screen or for printing.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]copiesAn integer value which specifies the number of copies to be printed when the print dialog is opened for this file. If this is below 0, this function will typically set the number of copies to 1. Supported values are the integers 2 through 5. Values outside this range are ignored.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or copies is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting print copies is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set the number of copies because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetPrintRanges ( FSCRT_DOCUMENT  document,
const FS_INT32 pageRanges,
FS_INT32  count 
)

Set the page ranges to be printed.

Viewer preferences define the way that a document is to be presented on the screen or for printing.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]pageRangesPointer to a FS_INT32 object which specifies a array to record the page ranges to print.
In this array, 2 numbers are a pair: the first integer is the starting page number, and the second integer is the ending page number.
[in]countAn integer value which indicates the count of elements in the parameter pageRanges. It should be an even number.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or pageRanges is a NULL pointer, or count is not an even number.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting print rages is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set the page ranges because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetPrintScale ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR printScale 
)

Set page scaling in viewer preferences.

Viewer preferences define the way that a document is to be presented on the screen or for printing.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]printScalePointer to a FSCRT_BSTR structure which is a UTF-8 string value to specify page scale. It should be one of following:
  • "None": the print dialog should reflect no page scaling.
  • "AppDefault": applications should use the current print scaling.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or printScale is a NULL pointer, or printScale is empty.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting print scaling is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set print scaling because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetReadingDirection ( FSCRT_DOCUMENT  document,
FS_INT32  direction 
)

Set reading direction in viewer preferences.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]directionAn integer value which specifies reading direction:
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document is a NULL pointer, or direction is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting reading direction is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set reading direction because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_ViewerPref_SetUIVisibility ( FSCRT_DOCUMENT  document,
const FSCRT_BSTR uiItem,
FS_BOOL  uiVisible 
)

Set UI visibility in viewer preferences.

Viewer preferences define the way that a document is to be presented on the screen or for printing.

Parameters
[in]documentHandle to a valid FSCRT_DOCUMENT object which is a PDF document object.
[in]uiItemPointer to a UTF-8 key string, it should be a valid pointer to FSCRT_BSTR structure.
Currently it can be one of the following values:
  • "HideToolbar"
  • "HideMenubar"
  • "HideWindowUI"
  • "FitWindow"
  • "CenterWindow"
  • "DisplayDocTitle"
  • Some other custom UI item keys, if they're supported by the PDF.
[in]uiVisibleA boolean value that specifies the UI visibility.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or uiItem is a NULL pointer, or uiItem is empty.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting UI visibility is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a valid PDF document type.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_NOTPARSED if the parameter document has not been parsed successfully when being loaded or reloaded.
FSCRT_ERRCODE_ERROR if failing to set UI visibility because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_WrapperData_Clear ( FSPDF_WRAPPERDATA wrapperData)

Helper function to clear a wrapper data object.

Parameters
[in]wrapperDataPointer to a FSPDF_WRAPPERDATA structure to be cleared.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter wrapperData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This helper function is used to clear string buffer. It sets FSPDF_WRAPPERDATA::version field to zero and calls function FSCRT_BStr_Clear to other string fields.
Do not clear objects with a non-compatible method in Foxit PDF SDK.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_WrapperData_Init ( FSPDF_WRAPPERDATA wrapperData)

Helper function to initialize a wrapper data object.

Parameters
[in]wrapperDataPointer to a FSPDF_WRAPPERDATA structure to be initialized.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter wrapperData is a NULL pointer.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This helper function is used to initialize a wrapper data variant. It sets FSPDF_WRAPPERDATA::version field to zero and calls function FSCRT_BStr_Init to other string fields.
Do not initialize with a non-compatible method to Foxit PDF SDK.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.

Foxit Corporation