Foxit PDF SDK
foxit::pdf::PDFDoc Class Reference
Inheritance diagram for foxit::pdf::PDFDoc:
foxit::Base

Public Types

enum  DataType { e_Forms = 0x0001, e_Annots = 0x0002, e_Links = 0x0004 }
 Enumeration for data type used to decide which object(s) will be imported from or exported to FDF/XFDF document. More...
 
enum  DisplayMode {
  e_DisplayUseNone = 0, e_DisplayUseOutlines = 1, e_DisplayUseThumbs = 2, e_DisplayFullScreen = 3,
  e_DisplayUseOC = 4, e_DisplayUseAttachment = 5
}
 Enumeration for display mode which specifies how the document should be displayed when opened. More...
 
enum  EncryptType {
  e_EncryptUnknown = -1, e_EncryptNone = 0, e_EncryptPassword = 1, e_EncryptCertificate = 2,
  e_EncryptFoxitDRM = 3, e_EncryptCustom = 4, e_EncryptRMS = 5, e_EncryptCDRM = 6
}
 Enumeration for encryption type. More...
 
enum  ExtractPagesOptions {
  e_ExtractPagesOptionAnnotation = 0x0001, e_ExtractPagesOptionStructureTree = 0x0002, e_ExtractPagesOptionJavascript = 0x0004, e_ExtractPagesOptionOCProperties = 0x0008,
  e_ExtractPagesOptionObjectStream = 0x0010, e_ExtractPagesOptionAttachFiles = 0x0020
}
 Enumeration for options used for extracting pages. More...
 
enum  ImportPageFlags { e_ImportFlagNormal = 0, e_ImportFlagWithLayers = 0x0001, e_ImportFlagShareStream = 0x0002 }
 Enumeration for flags used for importing pages. More...
 
enum  InsertDocOptions { e_InsertDocOptionAttachments = 0x0001 }
 Enumeration for options used for inserting a PDF document to another. More...
 
enum  PasswordType { e_PwdInvalid = 0, e_PwdNoPassword = 1, e_PwdUser = 2, e_PwdOwner = 3 }
 Enumeration for the type of current used password in a PDF document. More...
 
enum  SaveFlags {
  e_SaveFlagNormal = 0, e_SaveFlagIncremental = 0x0001, e_SaveFlagNoOriginal = 0x0002, e_SaveFlagXRefStream = 0x0008,
  e_SaveFlagLinearized = 0x1000, e_SaveFlagRemoveRedundantObjects = 0x0010
}
 Enumeration for PDF document saving flags. More...
 
enum  UserPermissions {
  e_PermPrint = 0x0004, e_PermModify = 0x0008, e_PermExtract = 0x0010, e_PermAnnotForm = 0x0020,
  e_PermFillForm = 0x0100, e_PermExtractAccess = 0x0200, e_PermAssemble = 0x0400, e_PermPrintHigh = 0x0800
}
 Enumeration for user access permissions in a PDF document. More...
 
enum  WrapperType { e_WrapperNone = 0, e_WrapperFoxit = 1, e_WrapperPDFV2 = 2 }
 Enumeration for wrapper type. More...
 

Public Member Functions

 PDFDoc ()
 Constructor. More...
 
 PDFDoc (const char *path)
 Constructor, from an existing PDF file path. More...
 
 PDFDoc (const wchar_t *path)
 Constructor, from an existing PDF file path. More...
 
 PDFDoc (const void *buffer, size_t size)
 Constructor, from a memory buffer. More...
 
 PDFDoc (common::file::ReaderCallback *file_read, bool is_async=false)
 Constructor, with a file read callback object. More...
 
 PDFDoc (const PDFDoc &other)
 Constructor, with another PDF document object. More...
 
 ~PDFDoc ()
 Destructor.
 
uint32 AddIndirectObject (objects::PDFObject *pdf_object)
 Add a PDF object to current PDF document, to be an indirect object. More...
 
PasswordType CheckPassword (const String &password)
 Check the type of a specified password. More...
 
PasswordType CheckPassword (const foxit::WString &password)
 Check the type of a specified unicode password. More...
 
void ClearRenderCache ()
 Clear the cache used during rendering, to reduce the memory usage. More...
 
void CreateDSS ()
 Create DSS information in current PDF document. More...
 
Bookmark CreateRootBookmark ()
 Create new bookmark root node. More...
 
void DeleteIndirectObject (uint32 object_number)
 Delete an indirect object by indirect object number. More...
 
bool DoJSOpenAction ()
 Perform JavaScript actions when the document is opened. More...
 
bool ExportAnnotToFDF (const annots::Annot &pdf_annot, const fdf::FDFDoc &fdf_doc)
 Export specified annotation to a FDF/XFDF document. More...
 
bool ExportToFDF (const fdf::FDFDoc &fdf_doc, int types=pdf::PDFDoc::e_Forms|pdf::PDFDoc::e_Annots, const common::Range &page_range=common::Range())
 Export form fields and annotations to a FDF/XFDF document. More...
 
objects::PDFDictionaryGetCatalog () const
 Get the catalog dictionary. More...
 
CertificateEncryptData GetCertificateEncryptData () const
 Get encrypt data of certificate encryption. More...
 
CustomEncryptData GetCustomEncryptData () const
 Get encrypt data of custom encryption. More...
 
DisplayMode GetDisplayMode () const
 Get the display mode. More...
 
DRMEncryptData GetDRMEncryptData () const
 Get encrypt data of Foxit DRM encryption. More...
 
objects::PDFDictionaryGetEncryptDict () const
 Get the encrypt dictionary. More...
 
EncryptType GetEncryptionType () const
 Get the encryption type. More...
 
uint64 GetFileSize ()
 Get file size. More...
 
int GetFileVersion ()
 Get PDF file version stored in PDF header section. More...
 
int GetFirstAvailPageIndex () const
 Get the page index of the fist available page. More...
 
common::Font GetFont (int index)
 Get a font by index. More...
 
int GetFontCount ()
 Count all the PDF fonts used in current PDF document. More...
 
String GetHeader () const
 Get PDF header identifying the version of the PDF specification to which the file conforms. More...
 
objects::PDFObjectGetIndirectObject (uint32 object_number)
 Get an indirect object by indirect object number. More...
 
objects::PDFDictionaryGetInfo () const
 Get the information dictionary. More...
 
actions::Action GetOpenAction ()
 Get the action to be performed when the document is opened. More...
 
PDFPage GetPage (int index)
 Get a PDF page by index. More...
 
PageBasicInfo GetPageBasicInfo (int index)
 Get the basic information of a page specified by index. More...
 
int GetPageCount () const
 Get the count of pages. More...
 
objects::PDFDictionaryGetPagesDict () const
 Get the dictionary of "Pages". More...
 
PasswordType GetPasswordType () const
 Get the type of current used password. More...
 
PayLoadData GetPayLoadData ()
 Get payload data if current document's wrapper type is PDFDoc::e_WrapperPDFV2. More...
 
ReadingBookmark GetReadingBookmark (int index)
 Get a reading bookmark by index. More...
 
int GetReadingBookmarkCount ()
 Get the count of reading bookmarks. More...
 
RMSEncryptData GetRMSEncryptData () const
 Get encrypt data of RMS encryption. More...
 
Bookmark GetRootBookmark ()
 Get bookmark root node. More...
 
SecurityHandler GetSecurityHandler ()
 Get current PDF security handler of current document. More...
 
foxit::pdf::Signature GetSignature (int index)
 Get a signature by index. More...
 
int GetSignatureCount ()
 Get the count of signature. More...
 
StdEncryptData GetStdEncryptData () const
 Get encrypt data of standard encryption (known as password encryption). More...
 
objects::PDFDictionaryGetTrailer () const
 Get the trailer dictionary. More...
 
String GetUserPassword (const String &owner_password)
 Get the user password based on owner password. More...
 
uint32 GetUserPermissions () const
 Get user access permissions. More...
 
WrapperData GetWrapperData () const
 Get wrapper data if current document's wrapper type is PDFDoc::e_WrapperFoxit. More...
 
int64 GetWrapperOffset () const
 Get wrapper offset if current document's wrapper type is PDFDoc::e_WrapperFoxit. More...
 
WrapperType GetWrapperType () const
 Get Wrapper type. More...
 
bool HasForm () const
 Check whether current PDF document has interactive form (also known as AcroForm). More...
 
bool ImportFromFDF (const fdf::FDFDoc &fdf_doc, int types=pdf::PDFDoc::e_Forms|pdf::PDFDoc::e_Annots, const common::Range &page_range=common::Range())
 Import form fields and annotations from a FDF/XFDF document. More...
 
void InsertDocument (int dest_index, const PDFDoc &src_doc, uint32 options)
 Insert another PDF document to the specified location of current PDF document. More...
 
PDFPage InsertPage (int index, float width, float height)
 Insert a new blank PDF page to document, by index. More...
 
PDFPage InsertPage (int index, foxit::pdf::PDFPage::Size size=PDFPage::e_SizeLetter)
 Insert a new blank PDF page to document, by index. More...
 
ReadingBookmark InsertReadingBookmark (int reading_bookmark_index, const WString &title, int dest_page_index)
 Insert a reading bookmark to current PDF document. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
bool IsEncrypted () const
 Check whether current document is an encrypted file or not. More...
 
bool IsLinearized () const
 Check if current PDF document is a linearized file. More...
 
bool IsOwnerPassword (const String &password)
 Check if input password is the owner password of current PDF document. More...
 
bool IsOwnerPassword (const foxit::WString &password)
 Check if input password is the owner password of current PDF document. More...
 
bool IsPortfolio ()
 Check whether current PDF document is a portfolio file or not. More...
 
bool IsTaggedPDF () const
 Check if current PDF document is a Tagged PDF file. More...
 
bool IsUserPassword (const String &password)
 Check if input password is the user password of current PDF document. More...
 
bool IsUserPassword (const foxit::WString &password)
 Check if input password is the user password of current PDF document. More...
 
bool IsWrapper () const
 Check whether current document is a wrapper file or not. More...
 
bool IsXFA () const
 Check whether current PDF document is an XFA document. More...
 
ErrorCode Load (const String &password="")
 Load current document content by using a specified password. More...
 
ErrorCode LoadW (const WString &password=WString())
 Load current document content by using a specified password. More...
 
bool MovePagesTo (const common::Range &page_range, int dest_index)
 Move one or more pages (specified by index) to a new index position. More...
 
bool MovePageTo (const PDFPage &page, int dest_index)
 Move a specified page to a new index position. More...
 
bool operator!= (const PDFDoc &other) const
 Not equal operator. More...
 
PDFDocoperator= (const PDFDoc &other)
 Assign operator. More...
 
bool operator== (const PDFDoc &other) const
 Equal operator. More...
 
bool RemoveBookmark (const Bookmark &bookmark)
 Remove a specified bookmark. More...
 
bool RemoveOpenAction ()
 Remove the action to be performed when the document is opened. More...
 
bool RemovePage (int index)
 Remove a PDF page by page index. More...
 
bool RemovePage (const foxit::pdf::PDFPage &page)
 Remove a specified PDF page. More...
 
bool RemoveReadingBookmark (const ReadingBookmark &reading_bookmark)
 Remove a reading bookmark from current PDF document. More...
 
bool RemoveSecurity ()
 Remove the security handler from current document, so that the later saved document will be unencrypted. More...
 
void RemoveSignature (const foxit::pdf::Signature &signature)
 Remove a signature. More...
 
bool SaveAs (const char *file_path, uint32 save_flags=PDFDoc::e_SaveFlagNormal)
 Save current PDF document as another PDF file. More...
 
bool SaveAs (const wchar_t *file_path, uint32 save_flags=PDFDoc::e_SaveFlagNormal)
 Save current PDF document as another PDF file. More...
 
bool SaveAsWrapperFile (const wchar_t *file_path, const WrapperData *wrapper_data=0, uint32 user_permissions=0xFFFFFFFC, const char *owner_password="")
 Save current PDF document as a wrapper file. More...
 
void SetDisplayMode (DisplayMode display_mode)
 Set the display mode. More...
 
void SetFileVersion (int version)
 Set the PDF file version which will be stored in PDF header section of the saved PDF file. More...
 
bool SetOpenAction (actions::Action &action)
 Set the action to be performed when the document is opened. More...
 
bool SetSecurityHandler (const SecurityHandler &handler)
 Set a PDF security handler for encryption, such as standard encryption(password), certificate encryption, and so on. More...
 
common::Progressive StartExtractPages (const char *file_path, uint32 options, const common::Range &page_range=common::Range(), common::PauseCallback *pause=0)
 Start to extract pages from current PDF document. More...
 
common::Progressive StartExtractPages (const wchar_t *file_path, uint32 options, const common::Range &page_range=common::Range(), common::PauseCallback *pause=0)
 Start to extract pages from current PDF document. More...
 
common::Progressive StartExtractPages (foxit::common::file::WriterCallback *file, uint32 options, const foxit::common::Range &page_range=common::Range(), foxit::common::PauseCallback *pause=0)
 Start to extract pages from current PDF document. More...
 
common::Progressive StartGetPayloadFile (foxit::common::file::WriterCallback *payload_file, common::PauseCallback *pause=0)
 Start to get payload file. More...
 
common::Progressive StartImportPages (int dest_index, const PDFDoc &src_doc, uint32 flags=PDFDoc::e_ImportFlagNormal, const char *layer_name="", const common::Range &page_range=common::Range(), common::PauseCallback *pause=0)
 Start to import pages from another PDF document (via PDF document object). More...
 
common::Progressive StartImportPagesFromFilePath (int dest_index, const wchar_t *src_file_path, const String &password, uint32 flags=PDFDoc::e_ImportFlagNormal, const char *layer_name="", const common::Range &page_range=common::Range(), common::PauseCallback *pause=0)
 Start to import pages from another PDF document (via file path). More...
 
common::Progressive StartImportPagesFromFilePath (int dest_index, const wchar_t *src_file_path, const WString &password, uint32 flags=PDFDoc::e_ImportFlagNormal, const char *layer_name="", const common::Range &page_range=common::Range(), common::PauseCallback *pause=0)
 Start to import pages from another PDF document (via file path). More...
 
common::Progressive StartLoad (const String &password="", bool is_cache_stream=true, common::PauseCallback *pause=0)
 Start to loading current document content by using a specified password. More...
 
common::Progressive StartLoadW (const WString &password=WString(), bool is_cache_stream=true, common::PauseCallback *pause=0)
 Start to loading current document content by using a specified password. More...
 
common::Progressive StartSaveAs (const char *file_path, uint32 save_flags=PDFDoc::e_SaveFlagNormal, common::PauseCallback *pause=0)
 Start to save current PDF document as another PDF file. More...
 
common::Progressive StartSaveAs (const wchar_t *file_path, uint32 save_flags=PDFDoc::e_SaveFlagNormal, common::PauseCallback *pause=0)
 Start to save current PDF document as another PDF file. More...
 
common::Progressive StartSaveAs (foxit::common::file::WriterCallback *file, foxit::uint32 save_flags=PDFDoc::e_SaveFlagNormal, foxit::common::PauseCallback *pause=0)
 Start to save current PDF document as another PDF file. More...
 
common::Progressive StartSaveAsPayloadFile (const wchar_t *file_path, const wchar_t *payload_file_path, const wchar_t *crypto_filter, const wchar_t *description, float version, uint32 save_flags=PDFDoc::e_SaveFlagNormal, common::PauseCallback *pause=0)
 Start to save current PDF document as a wrapper document with a payload document (defined in PDF 2.0). More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

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

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

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

Member Enumeration Documentation

◆ DataType

Enumeration for data type used to decide which object(s) will be imported from or exported to FDF/XFDF document.

Values of this enumeration can be used alone or in combination.

Enumerator
e_Forms 

If set, form fields are to imported from or exported to FDF/XFDF document.

e_Annots 

If set, annotations (except link annotations) are to imported from or exported to FDF/XFDF document.

e_Links 

(Reserved, not supported yet) If set, only link annotations are to imported from or exported to XFDF document.

◆ DisplayMode

Enumeration for display mode which specifies how the document should be displayed when opened.

Values of this enumeration should be used alone.

Enumerator
e_DisplayUseNone 

When document is opened, neither document outlines nor thumbnail images are visible.

e_DisplayUseOutlines 

When document is opened, document outlines (bookmarks) are visible.

e_DisplayUseThumbs 

When document is opened, thumbnail images are visible.

e_DisplayFullScreen 

When document is opened, full-screen mode, with no menu bar, window controls, or any other windows are visible.

e_DisplayUseOC 

When document is opened, optional content group panels are visible.

e_DisplayUseAttachment 

When document is opened, attachment panels are visible.

◆ EncryptType

Enumeration for encryption type.

Values of this enumeration should be used alone.

Enumerator
e_EncryptUnknown 

Unknown encryption type.

e_EncryptNone 

No encryption pattern.

e_EncryptPassword 

Encryption type: password, which is the standard encryption.

e_EncryptCertificate 

Encryption type: digital certificate encryption.

e_EncryptFoxitDRM 

Encryption type: Foxit DRM encryption.

e_EncryptCustom 

Encryption type: customized encryption.

e_EncryptRMS 

Encryption type: Microsoft RMS encryption.

e_EncryptCDRM 

(Reserved, currently, this value is not used.) Encryption type: Foxit connected PDF DRM encryption.

◆ ExtractPagesOptions

Enumeration for options used for extracting pages.

Values of this enumeration can be used alone or in combination.

Enumerator
e_ExtractPagesOptionAnnotation 

If set, that means annotations related to extracted pages will be extracted as well.

e_ExtractPagesOptionStructureTree 

If set, that means structure tree will be extracted as well.

e_ExtractPagesOptionJavascript 

If set, that means Javascript will be extracted as well.

e_ExtractPagesOptionOCProperties 

If set, that means OCProperties will be extracted as well.

e_ExtractPagesOptionObjectStream 

If set, that means to use PDFDoc::e_SaveFlagXRefStream saving flag for the result file in order to reduce the size of result file.

e_ExtractPagesOptionAttachFiles 

If set, that means attachment files will be extracted as well.

◆ ImportPageFlags

Enumeration for flags used for importing pages.

Values of this enumeration can be used alone or in combination.

Enumerator
e_ImportFlagNormal 

Import pages normally.

e_ImportFlagWithLayers 

Import pages with layers.

e_ImportFlagShareStream 

Import pages without cloning stream objects into memory.

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

◆ InsertDocOptions

Enumeration for options used for inserting a PDF document to another.

Values of this enumeration can be used alone or in combination.

Enumerator
e_InsertDocOptionAttachments 

If set, that means attachments will be inserted to target document as well.

◆ PasswordType

Enumeration for the type of current used password in a PDF document.

Values of this enumeration should be used alone.

Enumerator
e_PwdInvalid 

The password is invalid.

e_PwdNoPassword 

No password is used in PDF document.

e_PwdUser 

A user password is used in PDF document.

e_PwdOwner 

An owner password is used in PDF document.

◆ SaveFlags

Enumeration for PDF document saving flags.

Values of this enumeration can be used alone or in combination.

Enumerator
e_SaveFlagNormal 

Save document normally, without using any special flag. This can only be used alone.

e_SaveFlagIncremental 

Save document incrementally.

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

e_SaveFlagNoOriginal 

Save document without original data or unchanged objects.

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

e_SaveFlagXRefStream 

Save document by using XRef stream.

This can be used alone or be combined with other saving flags except PDFDoc::e_SaveFlagNormal.

e_SaveFlagLinearized 

Save document as a linearized file.

This should be used alone and cannot be used with other saving flags. This can only be used for function pdf::PDFDoc::SaveAs or PDFDoc::StartSaveAs.

e_SaveFlagRemoveRedundantObjects 

Save document with removing redundant PDF objects.

This can be used alone or be combined with PDFDoc::e_SaveFlagNoOriginal or PDFDoc::e_SaveFlagXRefStream. This can only be used for function pdf::PDFDoc::SaveAs or PDFDoc::StartSaveAs.

◆ UserPermissions

Enumeration for user access permissions in a PDF document.

Values of this enumeration can be used alone or in combination.

Enumerator
e_PermPrint 

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

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

e_PermModify 

Modify PDF contents. (Bit 4 in permission value)

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

e_PermExtract 

Extract PDF contents. (Bit 5 in permission value)

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

e_PermAnnotForm 

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

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

e_PermFillForm 

Fill PDF form. (Bit 9 in permission value)

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

e_PermExtractAccess 

Disabilities support. (Bit 10 in permission value)

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

e_PermAssemble 

Assemble PDF document. (Bit 11 in permission value)

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

e_PermPrintHigh 

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

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

◆ WrapperType

Enumeration for wrapper type.

Values of this enumeration should be used alone.

Enumerator
e_WrapperNone 

Normal document.

e_WrapperFoxit 

Foxit wrapper document.

e_WrapperPDFV2 

PDF 2.0 wrapper document.

Constructor & Destructor Documentation

◆ PDFDoc() [1/6]

foxit::pdf::PDFDoc::PDFDoc ( )

Constructor.

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

◆ PDFDoc() [2/6]

foxit::pdf::PDFDoc::PDFDoc ( const char *  path)
explicit

Constructor, from an existing PDF file path.

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

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

◆ PDFDoc() [3/6]

foxit::pdf::PDFDoc::PDFDoc ( const wchar_t *  path)
explicit

Constructor, from an existing PDF file path.

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

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

◆ PDFDoc() [4/6]

foxit::pdf::PDFDoc::PDFDoc ( const void *  buffer,
size_t  size 
)
explicit

Constructor, from a memory buffer.

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

Parameters
[in]bufferA memory buffer, containing the serialized document. The PDF document data should be fully loaded in this memory buffer. It should not be NULL.
[in]sizeThe size of memory buffer. It should be above 0.

◆ PDFDoc() [5/6]

foxit::pdf::PDFDoc::PDFDoc ( common::file::ReaderCallback file_read,
bool  is_async = false 
)
explicit

Constructor, with a file read callback object.

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

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

◆ PDFDoc() [6/6]

foxit::pdf::PDFDoc::PDFDoc ( const PDFDoc other)

Constructor, with another PDF document object.

Parameters
[in]otherAnother PDF document object.

Member Function Documentation

◆ AddIndirectObject()

uint32 foxit::pdf::PDFDoc::AddIndirectObject ( objects::PDFObject pdf_object)

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

  • If input PDF object is a direct object (whose indirect object number is 0), this functions will change it to be an indirect object and add to PDF document. Then return the new indirect object number.
  • If input PDF object is already an indirect object (whose indirect object number is above 0), this function will not add it into document again. The return value will be its own indirect object number.
Parameters
[in]pdf_objectA objects::PDFObject object. It should not be NULL.
Returns
The new indirect object number. It would be above 0.

◆ CheckPassword() [1/2]

PasswordType foxit::pdf::PDFDoc::CheckPassword ( const String password)

Check the type of a specified password.

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

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

◆ CheckPassword() [2/2]

PasswordType foxit::pdf::PDFDoc::CheckPassword ( const foxit::WString password)

Check the type of a specified unicode password.

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

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

◆ ClearRenderCache()

void foxit::pdf::PDFDoc::ClearRenderCache ( )

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

Returns
None.

◆ CreateDSS()

void foxit::pdf::PDFDoc::CreateDSS ( )

Create DSS information in current PDF document.

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

Returns
None.

◆ CreateRootBookmark()

Bookmark foxit::pdf::PDFDoc::CreateRootBookmark ( )

Create new bookmark root node.

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

Returns
A bookmark object that represents the root bookmark.

◆ DeleteIndirectObject()

void foxit::pdf::PDFDoc::DeleteIndirectObject ( uint32  object_number)

Delete an indirect object by indirect object number.

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

◆ DoJSOpenAction()

bool foxit::pdf::PDFDoc::DoJSOpenAction ( )

Perform JavaScript actions when the document is opened.

Returns
true means success, while false means failure.

◆ ExportAnnotToFDF()

bool foxit::pdf::PDFDoc::ExportAnnotToFDF ( const annots::Annot pdf_annot,
const fdf::FDFDoc fdf_doc 
)

Export specified annotation to a FDF/XFDF document.

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

◆ ExportToFDF()

bool foxit::pdf::PDFDoc::ExportToFDF ( const fdf::FDFDoc fdf_doc,
int  types = pdf::PDFDoc::e_Forms|pdf::PDFDoc::e_Annots,
const common::Range page_range = common::Range() 
)

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

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

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

◆ GetCatalog()

objects::PDFDictionary* foxit::pdf::PDFDoc::GetCatalog ( ) const

Get the catalog dictionary.

Returns
The catalog dictionary.

◆ GetCertificateEncryptData()

CertificateEncryptData foxit::pdf::PDFDoc::GetCertificateEncryptData ( ) const

Get encrypt data of certificate encryption.

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

Returns
The encrypt data of certificate encryption.

◆ GetCustomEncryptData()

CustomEncryptData foxit::pdf::PDFDoc::GetCustomEncryptData ( ) const

Get encrypt data of custom encryption.

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

Returns
The encrypt data of custom encryption.

◆ GetDisplayMode()

DisplayMode foxit::pdf::PDFDoc::GetDisplayMode ( ) const

Get the display mode.

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

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

◆ GetDRMEncryptData()

DRMEncryptData foxit::pdf::PDFDoc::GetDRMEncryptData ( ) const

Get encrypt data of Foxit DRM encryption.

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

Returns
The encrypt data of Foxit DRM encryption.

◆ GetEncryptDict()

objects::PDFDictionary* foxit::pdf::PDFDoc::GetEncryptDict ( ) const

Get the encrypt dictionary.

Returns
The encrypt dictionary.

◆ GetEncryptionType()

EncryptType foxit::pdf::PDFDoc::GetEncryptionType ( ) const

Get the encryption type.

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

◆ GetFileSize()

uint64 foxit::pdf::PDFDoc::GetFileSize ( )

Get file size.

Returns
File size.

◆ GetFileVersion()

int foxit::pdf::PDFDoc::GetFileVersion ( )

Get PDF file version stored in PDF header section.

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

◆ GetFirstAvailPageIndex()

int foxit::pdf::PDFDoc::GetFirstAvailPageIndex ( ) const

Get the page index of the fist available page.

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

Returns
Page index of the first available page.

◆ GetFont()

common::Font foxit::pdf::PDFDoc::GetFont ( int  index)

Get a font by index.

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

◆ GetFontCount()

int foxit::pdf::PDFDoc::GetFontCount ( )

Count all the PDF fonts used in current PDF document.

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

Returns
The count of fonts.

◆ GetHeader()

String foxit::pdf::PDFDoc::GetHeader ( ) const

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

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

◆ GetIndirectObject()

objects::PDFObject* foxit::pdf::PDFDoc::GetIndirectObject ( uint32  object_number)

Get an indirect object by indirect object number.

Parameters
[in]object_numberThe indirect object number. It should be above 0.
Returns
A objects::PDFObject object that receives the indirect PDF object. NULL means not found.

◆ GetInfo()

objects::PDFDictionary* foxit::pdf::PDFDoc::GetInfo ( ) const

Get the information dictionary.

Document's information dictionary contains metadata for the document.

Returns
The information dictionary.

◆ GetOpenAction()

actions::Action foxit::pdf::PDFDoc::GetOpenAction ( )

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

Returns
An Action object.

◆ GetPage()

PDFPage foxit::pdf::PDFDoc::GetPage ( int  index)

Get a PDF page by index.

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

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

◆ GetPageBasicInfo()

PageBasicInfo foxit::pdf::PDFDoc::GetPageBasicInfo ( int  index)

Get the basic information of a page specified by index.

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

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

◆ GetPageCount()

int foxit::pdf::PDFDoc::GetPageCount ( ) const

Get the count of pages.

Returns
The count of page.

◆ GetPagesDict()

objects::PDFDictionary* foxit::pdf::PDFDoc::GetPagesDict ( ) const

Get the dictionary of "Pages".

Returns
The dictionary of "Pages".

◆ GetPasswordType()

PasswordType foxit::pdf::PDFDoc::GetPasswordType ( ) const

Get the type of current used password.

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

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

◆ GetPayLoadData()

PayLoadData foxit::pdf::PDFDoc::GetPayLoadData ( )

Get payload data if current document's wrapper type is PDFDoc::e_WrapperPDFV2.

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

◆ GetReadingBookmark()

ReadingBookmark foxit::pdf::PDFDoc::GetReadingBookmark ( int  index)

Get a reading bookmark by index.

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

◆ GetReadingBookmarkCount()

int foxit::pdf::PDFDoc::GetReadingBookmarkCount ( )

Get the count of reading bookmarks.

Returns
The count of reading bookmarks.

◆ GetRMSEncryptData()

RMSEncryptData foxit::pdf::PDFDoc::GetRMSEncryptData ( ) const

Get encrypt data of RMS encryption.

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

Returns
The encrypt data of RMS encryption.
Note
If module "RMS" is not defined in the license information which is used in function common::Library::Initialize, that means user has no right in using RMS related functions and this function will throw exception foxit::e_ErrInvalidLicense.

◆ GetRootBookmark()

Bookmark foxit::pdf::PDFDoc::GetRootBookmark ( )

Get bookmark root node.

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

◆ GetSecurityHandler()

SecurityHandler foxit::pdf::PDFDoc::GetSecurityHandler ( )

Get current PDF security handler of current document.

Returns
The PDF security handler object.
Note
If module "RMS" is not defined in the license information which is used in function common::Library::Initialize, that means user has no right in using RMS related functions and this function will throw exception foxit::e_ErrInvalidLicense.

◆ GetSignature()

foxit::pdf::Signature foxit::pdf::PDFDoc::GetSignature ( int  index)

Get a signature by index.

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

◆ GetSignatureCount()

int foxit::pdf::PDFDoc::GetSignatureCount ( )

Get the count of signature.

Returns
The count of signature.

◆ GetStdEncryptData()

StdEncryptData foxit::pdf::PDFDoc::GetStdEncryptData ( ) const

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

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

Returns
The encrypt data of standard encryption.

◆ GetTrailer()

objects::PDFDictionary* foxit::pdf::PDFDoc::GetTrailer ( ) const

Get the trailer dictionary.

Returns
The trailer dictionary.

◆ GetUserPassword()

String foxit::pdf::PDFDoc::GetUserPassword ( const String owner_password)

Get the user password based on owner password.

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

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

◆ GetUserPermissions()

uint32 foxit::pdf::PDFDoc::GetUserPermissions ( ) const

Get user access permissions.

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

◆ GetWrapperData()

WrapperData foxit::pdf::PDFDoc::GetWrapperData ( ) const

Get wrapper data if current document's wrapper type is PDFDoc::e_WrapperFoxit.

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

◆ GetWrapperOffset()

int64 foxit::pdf::PDFDoc::GetWrapperOffset ( ) const

Get wrapper offset if current document's wrapper type is PDFDoc::e_WrapperFoxit.

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

◆ GetWrapperType()

WrapperType foxit::pdf::PDFDoc::GetWrapperType ( ) const

Get Wrapper type.

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

◆ HasForm()

bool foxit::pdf::PDFDoc::HasForm ( ) const

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

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

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

◆ ImportFromFDF()

bool foxit::pdf::PDFDoc::ImportFromFDF ( const fdf::FDFDoc fdf_doc,
int  types = pdf::PDFDoc::e_Forms|pdf::PDFDoc::e_Annots,
const common::Range page_range = common::Range() 
)

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

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

Parameters
[in]fdf_docA valid FDF/XFDF document object, from which form fields and annotations will be imported.
[in]typesUsed to decide which kind of data will be imported. Please refer to values starting from PDFDoc::e_Forms and this can be one or a combination of these values. Default value: (PDFDoc::e_Forms | PDFDoc::e_Annots).
[in]page_rangeA range object that specifies some pages. Data (in specified types) from FDF/XFDF document will be imported to these specified pages. If this range object is constructed by default constructor and not set any value, that means data (in specified types) from FDF/XFDF document will be imported to related PDF pages whose index have been defined in FDF/XFDF document.
This parameter is only useful when parameter types contains PDFDoc::e_Annots.
Default value: a range object by default constructor and not set any value.
Returns
true means success, while false means failure.

◆ InsertDocument()

void foxit::pdf::PDFDoc::InsertDocument ( int  dest_index,
const PDFDoc src_doc,
uint32  options 
)

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

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

◆ InsertPage() [1/2]

PDFPage foxit::pdf::PDFDoc::InsertPage ( int  index,
float  width,
float  height 
)

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

Parameters
[in]indexThe page index for new page.
If parameter index is less than 0, the new page will be inserted to the first.
If parameter index is equal to or larger than current page count, the new page will be inserted to the end.
[in]widthWidth of new page (unit is 1/72 inch).
[in]heightHeight of new page (unit is 1/72 inch).
Returns
A new PDF page object which represents a blank page.

◆ InsertPage() [2/2]

PDFPage foxit::pdf::PDFDoc::InsertPage ( int  index,
foxit::pdf::PDFPage::Size  size = PDFPage::e_SizeLetter 
)

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

Parameters
[in]indexThe page index for new page.
If parameter index is less than 0, the new page will be inserted to the first.
If parameter index is equal to or larger than current page count, the new page will be inserted to the end.
[in]sizeSize type of new page. Please refer to values starting from PDFPage::e_SizeLetter and this should be one of these values. Default value: PDFPage::e_SizeLetter.
Returns
A new PDF page object, which represents a blank page.

◆ InsertReadingBookmark()

ReadingBookmark foxit::pdf::PDFDoc::InsertReadingBookmark ( int  reading_bookmark_index,
const WString title,
int  dest_page_index 
)

Insert a reading bookmark to current PDF document.

Parameters
[in]reading_bookmark_indexA reading bookmark index.
If reading_bookmark_index is less than 0, the new reading bookmark will be inserted to the first.
If reading_bookmark_index is equal to or larger than the count of reading bookmarks, the new reading bookmark will be inserted to the end.
[in]titleTitle string for new reading bookmark and should not an empty string.
[in]dest_page_indexThe index of destination page.
Returns
A new reading bookmark object.

◆ IsEmpty()

bool foxit::pdf::PDFDoc::IsEmpty ( ) const

Check whether current object is empty or not.

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

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

◆ IsEncrypted()

bool foxit::pdf::PDFDoc::IsEncrypted ( ) const

Check whether current document is an encrypted file or not.

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

◆ IsLinearized()

bool foxit::pdf::PDFDoc::IsLinearized ( ) const

Check if current PDF document is a linearized file.

  • If current document object is constructed with an common::file::AsyncReaderCallback object, this function can be used before or after the document is loaded successfully. Specially, if this function is called before document is loaded successfully, application should ensure the first 1024 bytes of the PDF file is available; otherwise, this function will call the callback function common::file::AsyncReaderCallback::AddDownloadHint to notify application the range of data which should be downloaded by application then, and then this function will throw exception foxit::e_ErrDataNotReady.
  • If current document object is constructed from other methods or with a common common::file::ReaderCallback object, this function can only be used after the document is loaded successfully; otherwise, exception foxit::e_ErrUnknownState will be thrown.
Returns
true means current PDF document is a linearized file, and false means current PDF document is not a linearized file.

◆ IsOwnerPassword() [1/2]

bool foxit::pdf::PDFDoc::IsOwnerPassword ( const String password)

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

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

◆ IsOwnerPassword() [2/2]

bool foxit::pdf::PDFDoc::IsOwnerPassword ( const foxit::WString password)

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

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

◆ IsPortfolio()

bool foxit::pdf::PDFDoc::IsPortfolio ( )

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

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

◆ IsTaggedPDF()

bool foxit::pdf::PDFDoc::IsTaggedPDF ( ) const

Check if current PDF document is a Tagged PDF file.

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

◆ IsUserPassword() [1/2]

bool foxit::pdf::PDFDoc::IsUserPassword ( const String password)

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

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

◆ IsUserPassword() [2/2]

bool foxit::pdf::PDFDoc::IsUserPassword ( const foxit::WString password)

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

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

◆ IsWrapper()

bool foxit::pdf::PDFDoc::IsWrapper ( ) const

Check whether current document is a wrapper file or not.

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

◆ IsXFA()

bool foxit::pdf::PDFDoc::IsXFA ( ) const

Check whether current PDF document is an XFA document.

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

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

◆ Load()

ErrorCode foxit::pdf::PDFDoc::Load ( const String password = "")

Load current document content by using a specified password.

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

Parameters
[in]passwordThe password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
Returns
foxit::e_ErrSuccess means success.
foxit::e_ErrFile means there is any error occurs when accessing to current document content.
foxit::e_ErrPassword means input password is wrong.
foxit::e_ErrFormat means the format of current document content is not PDF or the file is corrupted.
foxit::e_ErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
foxit::e_ErrCertificate means current PDF document is encrypted by digital certificate and current user does not have the correct certificate.
For other error code value, please refer to values starting from foxit::e_ErrSuccess for more details.

◆ LoadW()

ErrorCode foxit::pdf::PDFDoc::LoadW ( const WString password = WString())

Load current document content by using a specified password.

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

Parameters
[in]passwordThe password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
Returns
foxit::e_ErrSuccess means success.
foxit::e_ErrFile means there is any error occurs when accessing to current document content.
foxit::e_ErrPassword means input password is wrong.
foxit::e_ErrFormat means the format of current document content is not PDF or the file is corrupted.
foxit::e_ErrSecurityHandler means current PDF document is encrypted by some unsupported security handler.
foxit::e_ErrCertificate means current PDF document is encrypted by digital certificate and current user does not have the correct certificate.
For other error code value, please refer to values starting from foxit::e_ErrSuccess for more details.

◆ MovePagesTo()

bool foxit::pdf::PDFDoc::MovePagesTo ( const common::Range page_range,
int  dest_index 
)

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

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

Parameters
[in]page_rangeA range object which should at least contain one valid range. All the related pages will keep the order (specified by this range) and be moved as a whole. If there exist duplicated indexes in the range, only the last occurrence will be useful.
[in]dest_indexIndex of the destination position, based on current page array. Valid range: from 0 to (count-1). count is returned by function PDFDoc::GetPageCount.
Returns
true means success or no need to move current page, while false means failure.

◆ MovePageTo()

bool foxit::pdf::PDFDoc::MovePageTo ( const PDFPage page,
int  dest_index 
)

Move a specified page to a new index position.

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

Parameters
[in]pageA PDF page to be moved. It should be in current PDF document.
[in]dest_indexIndex of the destination position in page array. Valid range: from 0 to (count-1). count is returned by function PDFDoc::GetPageCount.
If parameter dest_index is just the same as the page index of parameter page, no change will be done and this function will return true directly.
Returns
true means success or no need to move current page, while false means failure.

◆ operator!=()

bool foxit::pdf::PDFDoc::operator!= ( const PDFDoc other) const

Not equal operator.

Parameters
[in]otherAnother PDF document object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

PDFDoc& foxit::pdf::PDFDoc::operator= ( const PDFDoc other)

Assign operator.

Parameters
[in]otherAnother PDF document object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::pdf::PDFDoc::operator== ( const PDFDoc other) const

Equal operator.

Parameters
[in]otherAnother PDF document object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ RemoveBookmark()

bool foxit::pdf::PDFDoc::RemoveBookmark ( const Bookmark bookmark)

Remove a specified bookmark.

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

◆ RemoveOpenAction()

bool foxit::pdf::PDFDoc::RemoveOpenAction ( )

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

Returns
true means success, while false means failure.

◆ RemovePage() [1/2]

bool foxit::pdf::PDFDoc::RemovePage ( int  index)

Remove a PDF page by page index.

Parameters
[in]indexThe page index. Valid range: from 0 to (count-1). count is returned by function PDFDoc::GetPageCount.
Returns
true means success, while false means failure.

◆ RemovePage() [2/2]

bool foxit::pdf::PDFDoc::RemovePage ( const foxit::pdf::PDFPage page)

Remove a specified PDF page.

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

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

◆ RemoveReadingBookmark()

bool foxit::pdf::PDFDoc::RemoveReadingBookmark ( const ReadingBookmark reading_bookmark)

Remove a reading bookmark from current PDF document.

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

◆ RemoveSecurity()

bool foxit::pdf::PDFDoc::RemoveSecurity ( )

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

Returns
true means success, while false means failure.
Note
If module "RMS" is not defined in the license information which is used in function common::Library::Initialize, that means user has no right in using RMS related functions and this function will throw exception foxit::e_ErrInvalidLicense.

◆ RemoveSignature()

void foxit::pdf::PDFDoc::RemoveSignature ( const foxit::pdf::Signature signature)

Remove a signature.

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

◆ SaveAs() [1/2]

bool foxit::pdf::PDFDoc::SaveAs ( const char *  file_path,
uint32  save_flags = PDFDoc::e_SaveFlagNormal 
)

Save current PDF document as another PDF file.

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

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from PDFDoc::e_SaveFlagNormal and this can be one or combination of these values. Default value: PDFDoc::e_SaveFlagNormal.
Returns
true means the saving is successfully finished, while false means failure.
Note
This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
Then user can open the saved PDF file to do other operation.

◆ SaveAs() [2/2]

bool foxit::pdf::PDFDoc::SaveAs ( const wchar_t *  file_path,
uint32  save_flags = PDFDoc::e_SaveFlagNormal 
)

Save current PDF document as another PDF file.

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

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from PDFDoc::e_SaveFlagNormal and this can be one or combination of these values. Default value: PDFDoc::e_SaveFlagNormal.
Returns
true means the saving is successfully finished, while false means failure.
Note
This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
Then user can open the saved PDF file to do other operation.

◆ SaveAsWrapperFile()

bool foxit::pdf::PDFDoc::SaveAsWrapperFile ( const wchar_t *  file_path,
const WrapperData wrapper_data = 0,
uint32  user_permissions = 0xFFFFFFFC,
const char *  owner_password = "" 
)

Save current PDF document as a wrapper file.

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

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

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

Parameters
[in]file_pathA full path of a PDF file. Current PDF document will be saved into this PDF file as a wrapper file.
[in]wrapper_dataWrapper data. If this is NULL, no wrapper data is used. Default value: NULL.
[in]user_permissionsUser permissions for the wrapper document. Pass 0xFFFFFFFC if no special permissions is needed. Please refer to values starting from PDFDoc::e_PermPrint and this should be one or combination of these values. Default value: 0xFFFFFFFC.
[in]owner_passwordOwner password. If this is an empty string, parameter user_permissions will be ignored. Default value: an empty string.
Returns
true means success, while false means failure.

◆ SetDisplayMode()

void foxit::pdf::PDFDoc::SetDisplayMode ( DisplayMode  display_mode)

Set the display mode.

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

Parameters
[in]display_modeDisplay mode value. Please refer to values starting from PDFDoc::e_DisplayUseNone and this should be one of these values.
Returns
None.

◆ SetFileVersion()

void foxit::pdf::PDFDoc::SetFileVersion ( int  version)

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

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

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

◆ SetOpenAction()

bool foxit::pdf::PDFDoc::SetOpenAction ( actions::Action action)

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

Parameters
[in]actionA valid action to be set. Currently only support following types as the new action:
actions::Action::e_TypeGoto, actions::Action::e_TypeURI, actions::Action::e_TypeJavaScript, actions::Action::e_TypeNamed, actions::Action::e_TypeSubmitForm, actions::Action::e_TypeResetForm, actions::Action::e_TypeHide, actions::Action::e_TypeImportData.
Returns
true means success, while false means failure.

◆ SetSecurityHandler()

bool foxit::pdf::PDFDoc::SetSecurityHandler ( const SecurityHandler handler)

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

Parameters
[in]handlerA PDF security handler object.
Returns
true means success, while false means failure.
Note
If module "RMS" is not defined in the license information which is used in function common::Library::Initialize, that means user has no right in using RMS related functions and this function will throw exception foxit::e_ErrInvalidLicense.

◆ StartExtractPages() [1/3]

common::Progressive foxit::pdf::PDFDoc::StartExtractPages ( const char *  file_path,
uint32  options,
const common::Range page_range = common::Range(),
common::PauseCallback pause = 0 
)

Start to extract pages from current PDF document.

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

Parameters
[in]file_pathA full path for the new saved PDF file which is used to save the extracted pages. It should not be an empty string.
[in]optionsOptions for extracting pages. Please refer to values starting from PDFDoc::e_ExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
[in]page_rangeA range object to specify which pages are to be extracted. If this range object is constructed by default constructor and not set any value, all pages in the current document will be extracted. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the extracting process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartExtractPages() [2/3]

common::Progressive foxit::pdf::PDFDoc::StartExtractPages ( const wchar_t *  file_path,
uint32  options,
const common::Range page_range = common::Range(),
common::PauseCallback pause = 0 
)

Start to extract pages from current PDF document.

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

Parameters
[in]file_pathA full path for the new saved PDF file which is used to save the extracted pages. It should not be an empty string.
[in]optionsOptions for extracting pages. Please refer to values starting from PDFDoc::e_ExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
[in]page_rangeA range object to specify which pages are to be extracted. If this range object is constructed by default constructor and not set any value, all pages in the current document will be extracted. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the extracting process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartExtractPages() [3/3]

common::Progressive foxit::pdf::PDFDoc::StartExtractPages ( foxit::common::file::WriterCallback file,
uint32  options,
const foxit::common::Range page_range = common::Range(),
foxit::common::PauseCallback pause = 0 
)

Start to extract pages from current PDF document.

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

Parameters
[in]fileA common::file::WriterCallback object which is implemented by user to store the data of all the extracted pages in custom method.
[in]optionsOptions for extracting pages. Please refer to values starting from PDFDoc::e_ExtractPagesOptionAnnotation and this can be one or a combination of these values. 0 means no option is used.
[in]page_rangeA range object to specify which pages are to be extracted. If this range object is constructed by default constructor and not set any value, all pages in the current document will be extracted. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the extracting process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartGetPayloadFile()

common::Progressive foxit::pdf::PDFDoc::StartGetPayloadFile ( foxit::common::file::WriterCallback payload_file,
common::PauseCallback pause = 0 
)

Start to get payload file.

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

Parameters
[in]payload_fileA WriterCallback callback object. User should implement the callback function in this callback object in order that this callback object can be used to save payload file.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartImportPages()

common::Progressive foxit::pdf::PDFDoc::StartImportPages ( int  dest_index,
const PDFDoc src_doc,
uint32  flags = PDFDoc::e_ImportFlagNormal,
const char *  layer_name = "",
const common::Range page_range = common::Range(),
common::PauseCallback pause = 0 
)

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

It may take a long time to importing pages, so Foxit PDF SDK uses a progressive process to do this.
Signed signatures in the pages of source PDF document will not be imported into current PDF document.
Currently, if either current PDF document or the source PDF document contains XFA, not support to do the importing.
From Foxit PDF SDK 7.1, user is strongly recommended to use functions PDFDoc::StartExtractPages and PDFDoc::InsertDocument together, instead of current function. Execution efficiency of importing pages has been optimized in new functions.

Parameters
[in]dest_indexA page index in current PDF document. This is used to specify where the imported pages will be inserted: If parameter dest_index is less than 0, the imported pages will be inserted to the first.
If parameter dest_index is equal to or larger than current page count, the imported pages will be inserted to the end.
[in]src_docA PDF document object which is the source PDF document. Pages in this document will be imported to current PDF document. Please keep this source PDF document object valid until current document will not be saved any more or is closed.
[in]flagsOptions for importing pages. Please refer to values starting from PDFDoc::e_ImportFlagNormal and this can be one or a combination of these values. Default value: PDFDoc::e_ImportFlagNormal.
[in]layer_nameThe name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application. Default value: an empty string.
If parameter flags contains PDFDoc::e_ImportFlagWithLayers, this should not be empty and should be a valid string. If parameter flags does not contain PDFDoc::e_ImportFlagWithLayers, this string will be ignored.
  • If all the pages of source PDF document is to be imported to current document, all layers from source document will be grouped under a non-selectable label, and this string will be directly used as the label.
  • If only part of pages of source PDF document is to be imported to current document, layers in the same page will be grouped under a single non-selectable label, and this string will be used as the prefix name of the label. The label will be like "layerName_Page_X".
[in]page_rangeA range object to specify which pages is to be inserted. If this range object is constructed by default constructor and not set any value, all pages in the source document will be imported. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the importing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartImportPagesFromFilePath() [1/2]

common::Progressive foxit::pdf::PDFDoc::StartImportPagesFromFilePath ( int  dest_index,
const wchar_t *  src_file_path,
const String password,
uint32  flags = PDFDoc::e_ImportFlagNormal,
const char *  layer_name = "",
const common::Range page_range = common::Range(),
common::PauseCallback pause = 0 
)

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

It may take a long time to importing pages, so Foxit PDF SDK uses a progressive process to do this.
Signed signatures in the pages of source PDF document will not be imported into current PDF document.
Currently, Foxit PDF SDK does not support to do the importing if either current PDF document or the source PDF document contains XFA.
From Foxit PDF SDK 7.1, user is strongly recommended to use functions PDFDoc::StartExtractPages and PDFDoc::InsertDocument together, instead of current function. Execution efficiency of importing pages has been optimized in new functions.

Parameters
[in]dest_indexA page index in current PDF document. This is used to specify where the imported pages will be inserted. If parameter dest_index is less than 0, the imported pages will be inserted to the first.
If parameter dest_index is equal to or larger than current page count, the imported pages will be inserted to the end.
[in]src_file_pathA full path of an existing PDF file as the source PDF document Some pages will be imported from this PDF file to current PDF document.
[in]passwordA password string used to load source PDF document content. The password can be either user password or owner password. If source PDF document is not encrypted by password, just pass an empty string.
[in]flagsOptions for importing pages. Please refer to values starting from PDFDoc::e_ImportFlagNormal and this can be one or a combination of these values. Default value: PDFDoc::e_ImportFlagNormal.
[in]layer_nameThe name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application. Default value: an empty string.
If parameter flags contains PDFDoc::e_ImportFlagWithLayers, this should not be empty and should be a valid string. If parameter flags does not contain PDFDoc::e_ImportFlagWithLayers, this string will be ignored.
  • If all the pages of source PDF document is to be imported to current document, all layers from source document will be grouped under a non-selectable label, and this string will be directly used as the label.
  • If only part of pages of source PDF document is to be imported to current document, layers in the same page will be grouped under a single non-selectable label, and this string will be used as the prefix name of the label. The label will be like "layerName_Page_X".
[in]page_rangeA range object to specify which pages is to be imported. If this range object is constructed by default constructor and not set any value, all pages in the source document will be imported. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the importing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartImportPagesFromFilePath() [2/2]

common::Progressive foxit::pdf::PDFDoc::StartImportPagesFromFilePath ( int  dest_index,
const wchar_t *  src_file_path,
const WString password,
uint32  flags = PDFDoc::e_ImportFlagNormal,
const char *  layer_name = "",
const common::Range page_range = common::Range(),
common::PauseCallback pause = 0 
)

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

It may take a long time to importing pages, so Foxit PDF SDK uses a progressive process to do this.
Signed signatures in the pages of source PDF document will not be imported into current PDF document.
Currently, Foxit PDF SDK does not support to do the importing if either current PDF document or the source PDF document contains XFA.
From Foxit PDF SDK 7.1, user is strongly recommended to use functions PDFDoc::StartExtractPages and PDFDoc::InsertDocument together, instead of current function. Execution efficiency of importing pages has been optimized in new functions.

Parameters
[in]dest_indexA page index in current PDF document. This is used to specify where the imported pages will be inserted. If parameter dest_index is less than 0, the imported pages will be inserted to the first.
If parameter dest_index is equal to or larger than current page count, the imported pages will be inserted to the end.
[in]src_file_pathA full path of an existing PDF file as the source PDF document Some pages will be imported from this PDF file to current PDF document.
[in]passwordA password string used to load source PDF document content. The password can be either user password or owner password. If source PDF document is not encrypted by password, just pass an empty string.
[in]flagsOptions for importing pages. Please refer to values starting from PDFDoc::e_ImportFlagNormal and this can be one or a combination of these values. Default value: PDFDoc::e_ImportFlagNormal.
[in]layer_nameThe name of non-selectable label or the prefix name of the non-selectable label to be shown in layer panel of application. Default value: an empty string.
If parameter flags contains PDFDoc::e_ImportFlagWithLayers, this should not be empty and should be a valid string. If parameter flags does not contain PDFDoc::e_ImportFlagWithLayers, this string will be ignored.
  • If all the pages of source PDF document is to be imported to current document, all layers from source document will be grouped under a non-selectable label, and this string will be directly used as the label.
  • If only part of pages of source PDF document is to be imported to current document, layers in the same page will be grouped under a single non-selectable label, and this string will be used as the prefix name of the label. The label will be like "layerName_Page_X".
[in]page_rangeA range object to specify which pages is to be imported. If this range object is constructed by default constructor and not set any value, all pages in the source document will be imported. Default value: a range object by default constructor and not set any value.
[in]pausePause object which decides if the importing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartLoad()

common::Progressive foxit::pdf::PDFDoc::StartLoad ( const String password = "",
bool  is_cache_stream = true,
common::PauseCallback pause = 0 
)

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

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

  • Loading stream content into memory will improve performance for frequent access, however, it will also consume a lot of memory space.
  • Not to load stream content into memory, that means to leave stream content on file system, and read them when needed. This may reduce the performance a little bit, but greatly reduce the memory consumption, especially when the file is big.
Parameters
[in]passwordA password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
[in]is_cache_streamtrue means to load stream content into memory, and false means not to load stream content into memory and just leave stream content on file system and read them when needed. Please refer to "Details" part about the difference between these two modes. Default value: true.
[in]pausePause object which decides if the loading process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartLoadW()

common::Progressive foxit::pdf::PDFDoc::StartLoadW ( const WString password = WString(),
bool  is_cache_stream = true,
common::PauseCallback pause = 0 
)

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

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

  • Loading stream content into memory will improve performance for frequent access, however, it will also consume a lot of memory space.
  • Not to load stream content into memory, that means to leave stream content on file system, and read them when needed. This may reduce the performance a little bit, but greatly reduce the memory consumption, especially when the file is big.
Parameters
[in]passwordA password string, used to load current document content. The password can be either user password or owner password. If current document is not encrypted by password, just pass an empty string. Default value: an empty string.
[in]is_cache_streamtrue means to load stream content into memory, and false means not to load stream content into memory and just leave stream content on file system and read them when needed. Please refer to "Details" part about the difference between these two modes. Default value: true.
[in]pausePause object which decides if the loading process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.

◆ StartSaveAs() [1/3]

common::Progressive foxit::pdf::PDFDoc::StartSaveAs ( const char *  file_path,
uint32  save_flags = PDFDoc::e_SaveFlagNormal,
common::PauseCallback pause = 0 
)

Start to save current PDF document as another PDF file.

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

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from PDFDoc::e_SaveFlagNormal and this can be one or combination of these values. Default value: PDFDoc::e_SaveFlagNormal.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.
Note
This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
Then user can open the saved PDF file to do other operation.

◆ StartSaveAs() [2/3]

common::Progressive foxit::pdf::PDFDoc::StartSaveAs ( const wchar_t *  file_path,
uint32  save_flags = PDFDoc::e_SaveFlagNormal,
common::PauseCallback pause = 0 
)

Start to save current PDF document as another PDF file.

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

Parameters
[in]file_pathA full path for the new saved PDF file. It should not be an empty string.
[in]save_flagsDocument saving flags. Please refer to values starting from PDFDoc::e_SaveFlagNormal and this can be one or combination of these values. Default value: PDFDoc::e_SaveFlagNormal.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.
Note
This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
Then user can open the saved PDF file to do other operation.

◆ StartSaveAs() [3/3]

common::Progressive foxit::pdf::PDFDoc::StartSaveAs ( foxit::common::file::WriterCallback file,
foxit::uint32  save_flags = PDFDoc::e_SaveFlagNormal,
foxit::common::PauseCallback pause = 0 
)

Start to save current PDF document as another PDF file.

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

Parameters
[in]fileA common::file::WriterCallback object which is implemented by user to save a PDF document.
[in]save_flagsDocument saving flags. Please refer to values starting from PDFDoc::e_SaveFlagNormal and this can be one or combination of these values. Default value: PDFDoc::e_SaveFlagNormal.
[in]pausePause callback object which decides if the parsing process needs to be paused. This can be NULL which means not to pause during the parsing process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to coninue the progress until the progress is finished.
Note
This function does not support to save current PDF document object just back to the PDF file which is used to construct current PDF object. In order to do so, user is recommended to do as following steps:
Assume that current PDF object is constructed from a PDF file named "org.pdf".
  1. Use current function to save current PDF object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current PDF object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
Then user can open the saved PDF file to do other operation.

◆ StartSaveAsPayloadFile()

common::Progressive foxit::pdf::PDFDoc::StartSaveAsPayloadFile ( const wchar_t *  file_path,
const wchar_t *  payload_file_path,
const wchar_t *  crypto_filter,
const wchar_t *  description,
float  version,
uint32  save_flags = PDFDoc::e_SaveFlagNormal,
common::PauseCallback pause = 0 
)

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

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

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