Comprehensive Guide for Developers: Features, Integration, and API Reference
Represents a PDF document. More...
#include <pdfsdk/cxx/document.h>
Public Member Functions | |
| bool | IsCompressed () const |
| Checks if the document is compressed. | |
| bool | IsModified () const |
| Checks if the document has been modified. | |
| void | SetModified (bool modified) |
| Sets the state of the document to modified. | |
| bool | IsRepaired () const |
| Allows to check if the document was repaired during the opening process. | |
| std::filesystem::path | GetFilePath () const |
| Gets the file path of the document. | |
| uint64_t | GetFileSize () const |
| Gets the file size of the document. | |
| PDVersion | GetFileVersion () const |
| Gets the PDF version of the document. | |
| void | Save (const std::filesystem::path &path, PDDocSaveFlags flags=kPDDocSaveFull|kPDDocSaveCompressed, ProgressMonitor *progmon=nullptr, const PDOptSaveSettings *optSettings=nullptr, const PDVersion *version=nullptr) |
| Saves the document to a file. | |
| void | SaveToStream (IWriteSink &sink, PDDocSaveFlags flags=kPDDocSaveFull|kPDDocSaveCompressed, ProgressMonitor *progmon=nullptr, const PDOptSaveSettings *optSettings=nullptr, const PDVersion *version=nullptr) |
| Saves the document to a caller-supplied sink. | |
| size_t | GetNumPages () const |
| Gets the number of pages in the document. | |
| Page | GetPage (size_t index) const |
| Gets the page at the specified index. | |
| Page | CreatePage (size_t insertAt, const RectF &mediaBox) |
| Creates a new page at the specified index with the given media box. | |
| void | CreatePages (size_t insertAt, size_t count, const RectF &mediaBox) |
| Creates multiple pages starting at the specified index with the given media box. | |
| void | DeletePages (const std::vector< size_t > &pageIndexes, ProgressMonitor *mon=nullptr) |
| Deletes the pages within the specified range. | |
| void | DeletePage (size_t index) |
| Deletes the page at the specified index. | |
| void | InsertPages (size_t insertAt, const Document &sourceDoc, const std::vector< size_t > &sourcePageIndexes={}, ProgressMonitor *mon=nullptr) |
| Inserts pages from another document into the current document. | |
| void | InsertPage (const Page &page, size_t insertAt) |
| Inserts a page at the specified index. | |
| void | MovePages (size_t insertAt, const std::vector< size_t > &pageIndexes, ProgressMonitor *mon=nullptr) |
| Moves pages within the document to a new position. | |
| std::wstring | GetInfoString (PDAtom infoDictKey) const |
| Gets the information string associated with the specified info string atom. | |
| void | SetInfoString (PDAtom infoDictKey, const std::wstring &infoValue) |
| Sets the information string associated with the specified info string atom. | |
| std::string | GetXmpMetadata () const |
| Gets full XMP metadata packet for document. | |
| void | SetXmpMetadata (const std::string &xmpPacket) |
| Sets XMP metadata packet for document. | |
| PDFAFlavor | GetPDFAFlavor () const |
| Gets the PDF/A flavor of the document according to its XMP metadata. | |
| PDDateTime | GetCreationDate () const |
| Gets the creation date of the document. | |
| void | SetCreationDate (const PDDateTime &date) |
| Sets the creation date of the document. | |
| PDDateTime | GetModDate () const |
| Gets the modification date of the document. | |
| void | SetModDate (const PDDateTime &date) |
| Sets the modification date of the document. | |
| void | SetPageLayout (PDAtom layout) |
| Sets the page layout of the document. | |
| PDAtom | GetPageLayout () const |
| Gets the page layout of the document. | |
| void | SetPageMode (PDAtom mode) |
| Sets the page mode of the document. | |
| PDAtom | GetPageMode () const |
| Gets the page mode of the document. | |
| void | SetPageDirection (PDPageDirection direction) |
| Sets the page direction of the document. | |
| PDPageDirection | GetPageDirection () const |
| Gets the page direction of the document. | |
| XObject | CreateFormXObject (const Content &content) |
| Creates a form XObject from the specified content stream. | |
| Pattern | CreatePatternTiling (PDETilingPatternPaintType paintType, PDETilingPatternTilingType tilingType, const RectF &bbox, float xStep, float yStep, const Content &content) |
| Creates a pattern object in the document using the specified pattern paint type. | |
| Pattern | CreatePatternShading (const Shading &shading) |
| Creates a pattern object in the document using the specified pattern shading. A shading pattern object is a PDF object that defines a smooth transition between colors. | |
| Font | CreateFontFromInfo (const PDFontInfo &fontInfo, bool forceSysFont=true, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault) |
| Creates a font in the document using the specified font information. | |
| Font | CreateFontEmbeddedCopy (const Font &font, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault) |
| Creates an embedded copy of the specified font in the document. | |
| Font | ConvertFontToType0 (const Font &font, PDEFontCreateFlags createFlags=kPDEFontCreateFlagsDefault) |
| Creates a Type0 (composite) equivalent of the specified font. The result can be used in place of the source font without modifying existing content streams. | |
| template<class EnumProc> | |
| void | EnumFonts (EnumProc enumProc, ProgressMonitor *mon=nullptr) const |
| Enumerates the fonts used in the document. | |
| size_t | GetNumFormFields () const |
| Gets the number of form fields in the document. | |
| FormField | GetFormField (size_t index) const |
| Gets the form field at the specified index. | |
| void | AddFormField (FormField field) |
| Adds a form field to the document. | |
| void | RemoveFormField (FormField field) |
| Removes the specified form field from the document. | |
| FormField | CreateFormField (const std::wstring &fullname, PDAtom type, PDFieldFlags flags) |
| Creates a new form field with the specified name, type, and flags. | |
| FormField | FindFormField (const std::wstring &fullname) const |
| Finds a form field with the specified full name. | |
| void | RenameFormField (FormField field, const std::wstring &fullname) |
| Renames a specified form field. | |
| void | ExportFormFDF (const std::filesystem::path &path, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values to a Forms Data Format (FDF) file. | |
| std::vector< Byte > | ExportFormFDFToMemory (std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values to an in-memory Forms Data Format (FDF) buffer. | |
| void | ExportFormFDFToStream (IWriteSink &sink, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values as FDF to a caller-supplied byte sink. | |
| void | ImportFormFDF (const std::filesystem::path &path) |
| Imports form field values from a Forms Data Format (FDF) file. | |
| void | ImportFormFDFFromMemory (std::span< const Byte > data) |
| Imports form field values from an in-memory Forms Data Format (FDF) buffer. | |
| void | ImportFormFDFFromStream (IDataSource &source) |
| Imports form field values from an FDF byte source. | |
| void | ExportFormXFDF (const std::filesystem::path &path, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values to an XFDF (XML Forms Data Format) file. | |
| std::vector< Byte > | ExportFormXFDFToMemory (std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values to an in-memory XFDF (XML Forms Data Format) buffer. | |
| void | ExportFormXFDFToStream (IWriteSink &sink, std::span< const FormField > fields=std::span< const FormField >(), bool exclude=true) |
| Exports the form field values as XFDF to a caller-supplied byte sink. | |
| void | ImportFormXFDF (const std::filesystem::path &path) |
| Imports form field values from an XFDF (XML Forms Data Format) file. | |
| void | ImportFormXFDFFromMemory (std::span< const Byte > data) |
| Imports form field values from an in-memory XFDF (XML Forms Data Format) buffer. | |
| void | ImportFormXFDFFromStream (IDataSource &source) |
| Imports form field values from an XFDF byte source. | |
| Object | CreateActionFieldsData (std::span< const FormField > fields) |
| Creates an action fields-data object referencing the given form fields. | |
| void | ResetForm (std::span< const FormField > fields=std::span< const FormField >(), PDResetFormFlags flags=kPDResetFormFlagExclude) |
| Resets form fields to their default values. | |
| bool | IsSigned () const |
| Checks if the document is signed. | |
| void | SaveSignedVersion (FormField sigField, const std::filesystem::path &path) const |
| Writes to a file the version of the document as it was at the time of signing. | |
| Action | CreateActionURI (const std::string &uri) |
| Creates a URI action with the specified URI. | |
| Action | CreateActionGoTo (Dest dest) |
| Creates a GoTo action with the specified destination. | |
| Action | CreateActionGoToR (const FileSpec &fileSpec, size_t pageIndex) |
| Creates a GoToR action with the specified file specification and page index. | |
| Action | CreateActionJavaScript (const std::wstring &jscode) |
| Creates a JavaScript action with the specified JavaScript code. | |
| Action | CreateActionSubmitForm (const std::string &serverUri) |
| Creates a SubmitForm action with the specified server URI. | |
| Action | CreateActionResetForm () |
| Creates a ResetForm action. | |
| Action | CreateActionHide () |
| Creates a Hide action. | |
| Action | CreateActionNamed (PDAtom name) |
| Creates a Named action with the specified name. | |
| void | SetOpenAction (Action action) |
| Sets the open action for the document. | |
| Action | GetOpenAction () const |
| Gets the open action of the document. | |
| Dest | CreateDestXYZ (size_t pageIndex, const PointF &xy, float zoom, bool isRemote=false) |
| Creates a destination with XYZ coordinates and zoom level. | |
| Dest | CreateDestFit (size_t pageIndex, bool isRemote=false) |
| Creates a destination that fits the entire page. | |
| Dest | CreateDestFitH (size_t pageIndex, float top, bool isRemote=false) |
| Creates a destination that fits the width of the page. | |
| Dest | CreateDestFitV (size_t pageIndex, float left, bool isRemote=false) |
| Creates a destination that fits the height of the page. | |
| Dest | CreateDestFitR (size_t pageIndex, const RectF &rect, bool isRemote=false) |
| Creates a destination that fits the specified rectangle on the page. | |
| Dest | CreateDestFitB (size_t pageIndex, bool isRemote=false) |
| Creates a destination that fits the bounding box of the page. | |
| Dest | CreateDestFitBH (size_t pageIndex, float top, bool isRemote=false) |
| Creates a destination that fits the width of the bounding box of the page. | |
| Dest | CreateDestFitBV (size_t pageIndex, float left, bool isRemote=false) |
| Creates a destination that fits the height of the bounding box of the page. | |
| void | SetOpenDestination (Dest dest) |
| Sets the open destination for the document. | |
| Dest | GetOpenDestination () const |
| Gets the open destination of the document. | |
| template<class EnumProc> | |
| void | EnumDocLevelJSActions (EnumProc enumProc) const |
| Enumerates the document-level JavaScript actions. | |
| Action | GetDocLevelJSAction (std::string_view name) const |
| Gets the document-level JavaScript action with the specified name. | |
| void | RemoveDocLevelJS () |
| Removes the document-level JavaScript actions. | |
| FileSpec | GetAttachment (std::string_view name) const |
| Gets the attachment with the specified name. | |
| template<class EnumProc> | |
| void | EnumAttachments (EnumProc enumProc) const |
| Enumerates the attachments in the document. | |
| void | AddAttachment (std::string_view name, FileSpec filespec) |
| Adds an attachment to the document. | |
| void | RemoveAttachment (std::string_view name) |
| Removes the attachment with the specified name. | |
| size_t | GetNumAttachments () const |
| Gets the number of attachments in the document. | |
| std::string | GetAttachmentNameByIndex (size_t index) const |
| Gets the name of the attachment at the specified index. | |
| FileSpec | CreateFileSpec (PDAtom fileSys, const std::wstring &path) |
| Creates a FileSpec with the specified file system and path. | |
| FileSpec | CreateEmbeddedFile (const std::wstring &path) |
| Creates an embedded file with the specified path. | |
| size_t | GetNumOutputIntents () const |
| Gets the number of Output Intents in the document. | |
| OutputIntent | GetOutputIntent (size_t index) const |
| Gets an Output Intent by index. | |
| void | AddOutputIntent (const OutputIntent &oi) |
| Adds an Output Intent to the document. | |
| void | RemoveOutputIntent (const OutputIntent &oi) |
| Removes an Output Intent from the document. | |
| Bookmark | GetRootBookmark () const |
| Gets the root bookmark of the document. | |
| Bookmark | CreateRootBookmark () |
| Creates a root bookmark for the document. | |
| OCConfig | GetOCConfig () const |
| Gets the document's default optional content configuration. | |
| void | SetOCConfig (const OCConfig &config) |
| Sets the document's default optional content configuration. | |
| size_t | GetNumOCAltConfigs () const |
| Gets the number of alternate optional content configurations. | |
| OCConfig | GetOCAltConfig (size_t index) const |
| Gets the alternate optional content configuration at the given index. | |
| OCGroup | CreateOCGroup (const std::wstring &name) |
| Creates an optional content group with the specified name. | |
| size_t | GetNumOCGroups () const |
| Gets the number of optional content groups in the document. | |
| OCGroup | GetOCGroup (size_t index) const |
| Gets the optional content group at the specified index. | |
| StructTreeRoot | GetStructTree () const |
| Gets the document's logical structure tree. | |
| StructTreeRoot | CreateStructTree () |
| Creates a logical structure tree for the document. | |
| void | RemoveStructTree () |
| Removes the document's logical structure tree. | |
| Annot | CreateTextAnnot (const RectF &rect) |
| Creates a text annotation with the specified dimensions. | |
| Annot | CreateLinkAnnot (const RectF &rect, Action action) |
| Creates a link annotation with the specified rectangle and action. | |
| Annot | CreateTextMarkupAnnot (PDAtom type, PDColorValue color, const QuadPoints &quads) |
| Creates a text markup annotation with the specified type, color, and quad points. | |
| Annot | CreateInkAnnot (PDColorValue color, float lineWidth, const std::vector< std::vector< PointF > > &points) |
| Creates an ink annotation with the specified color, line width, and points. | |
| Annot | CreateFreeTextAnnot (const RectF &rect) |
| Creates a free text annotation with the specified rectangle. | |
| Annot | CreateStampAnnot (const RectF &rect, const XObject &appearance) |
| Creates a (rubber) stamp annotation with the specified rectangle and appearance. | |
| Annot | CreateWidgetAnnot (const FormField &field, const RectF &rect) |
| Creates a widget annotation for the specified form field. | |
| Annot | CreateFileAttachmentAnnot (const FileSpec &fileSpec, const RectF &rect) |
| Creates a file attachment annotation with the specified file specification and rectangle. For more information refer to ISO 32000-2:2020 (PDF 2.0) 12.5.6.11 File attachment annotations. | |
| Annot | CreatePopupAnnot (const RectF &rect) |
| Creates a popup annotation with the specified rectangle. | |
| Object | GetObjectByID (uint32_t id) const |
| Gets the indirect object with the specified ID. | |
| Object | GetRootObject () const |
| Gets the root object of the document. | |
| Object | GetInfoObject () const |
| Gets the info object of the document. | |
| Object | CreateBoolObject (bool value, bool indirect=false) |
| Creates a boolean value object. | |
| Object | CreateIntObject (int64_t value, bool indirect=false) |
| Creates an integer value object. | |
| Object | CreateRealObject (float value, bool indirect=false) |
| Creates a real number object. | |
| Object | CreateStringObjectUnicode (const std::wstring &unicode, bool indirect=false) |
| Creates a literal string object from a Unicode string. | |
| Object | CreateStringObject (const std::string &bytes, bool hex=false, bool indirect=false) |
| Creates a string object from a byte string. | |
| Object | CreateNameObject (PDAtom value, bool indirect=false) |
| Creates a name object. | |
| Object | CreateArrayObject (bool indirect) |
| Creates an array object. | |
| Object | CreateDictObject (bool indirect) |
| Creates a dictionary object. | |
| Object | CreateStreamObject (std::span< const Byte > data, const Object &attributesDict, const Object &encodeParms, bool encodeSource) |
| Creates a stream object. | |
| Object | CopyObject (const Object &source) |
| Copies an object. | |
| ReadStream | OpenXfaStream () const |
| Opens an XFA (XML Forms Architecture) stream. | |
| StdSecurityParams | GetStandardSecurityParams () const |
| Gets the standard security parameters of the document. | |
| void | SetStandardSecurityParams (const StdSecurityParams &requestedParams) |
| Sets the standard security parameters of the document. | |
| void | RemoveSecurity () |
| Removes any security handler and encryption applied to the document. | |
| bool | IsEncrypted () const |
| Checks if the document is encrypted. | |
| bool | RequestPermission (PDPermReqObj object, PDPermReqOp operation, const std::wstring &password=std::wstring()) const |
| Requests permission to perform an operation on the document. Permissions can be set either by the document's security handler or by the DocMDP. | |
| XObject | ImportIcon (const Document &source, size_t pageIndex=0) |
| Imports an icon from another document. | |
| void | CreatePageFromIcon (size_t insertAt, const Document &iconDoc, const XObject &icon) |
| Creates a page from an icon. | |
| bool | IsTaggedPDF () const |
| Checks if the PDF document is a tagged PDF. | |
| Document (PDDoc handle, bool adopt=false) noexcept | |
| Document (const Document &rhs) noexcept | |
| Document & | operator= (const Document &rhs) noexcept |
| Document (Document &&rhs) noexcept | |
| Document & | operator= (Document &&rhs) noexcept |
Static Public Member Functions | |
| static Document | OpenDocument (const std::filesystem::path &path, const std::wstring &password=std::wstring()) |
| Opens a PDF file from the specified path. | |
| static Document | OpenDocumentFromMemory (std::span< const Byte > data, bool copy=false, const std::wstring &password=std::wstring()) |
| Opens a PDF file from a memory buffer. | |
| static Document | OpenDocumentFromStream (std::shared_ptr< IDataSource > source, const std::wstring &password=std::wstring()) |
| Opens a PDF file from a caller-supplied data source. | |
| static Document | NewDocument (const RectF &mediaBox=RectF(0.0f, 792.0f, 612.0f, 0.0f)) |
| Creates a new PDF document. | |
Represents a PDF document.
| void PDF::Document::AddAttachment | ( | std::string_view | name, |
| FileSpec | filespec ) |
Adds an attachment to the document.
| [in] | name | A reference to the name of the attachment in wide character string format (i.e. L"FileAttachmentName"). |
| [in] | filespec | The FileSpec of the attachment. |
| void PDF::Document::AddFormField | ( | FormField | field | ) |
Adds a form field to the document.
For more information refer to section 12.7 Forms from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | field | The form field to add. |
| void PDF::Document::AddOutputIntent | ( | const OutputIntent & | oi | ) |
Adds an Output Intent to the document.
| [in] | oi | The Output Intent to append to the Catalog’s OutputIntents array. |
| Font PDF::Document::ConvertFontToType0 | ( | const Font & | font, |
| PDEFontCreateFlags | createFlags = kPDEFontCreateFlagsDefault ) |
Creates a Type0 (composite) equivalent of the specified font. The result can be used in place of the source font without modifying existing content streams.
| [in] | font | A reference to the source font. |
| [in] | createFlags | Flags that define additional options for font creation. |
Copies an object.
| [in] | source | A reference to the source object to copy. |
Creates an action fields-data object referencing the given form fields.
The returned object identifies a set of fields for APIs that operate on a field list, e.g. FormField::SetSignLock and ResetForm.
| [in] | fields | The form fields to reference. |
Creates a GoTo action with the specified destination.
A go-to action changes the view to a specified destination (page, location, and magnification factor). For more information refer to section 12.6.4.2 Go-To actions from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | dest | The destination for the action. The destination can be within the same document, another document or in an embedded file. |
Creates a GoToR action with the specified file specification and page index.
For more information refer to ISO 32000-2:2020 (PDF 2.0) section 12.6.4.3 Remote Go-To actions.
| [in] | fileSpec | The file specification for the remote document. |
| [in] | pageIndex | The page index in the remote document. |
| Action PDF::Document::CreateActionHide | ( | ) |
Creates a Hide action.
This action hides or shows one or more annotations on the screen by setting or clearing their hidden flags. For more information refer to section 12.6.4.11 Hide actions from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| Action PDF::Document::CreateActionJavaScript | ( | const std::wstring & | jscode | ) |
Creates a JavaScript action with the specified JavaScript code.
For more information refer to section 2.6.4.17 ECMAScript actions from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | jscode | A reference to the JavaScript code for the action in wide character string format (i.e. L"some javascript code to execute"). |
| Action PDF::Document::CreateActionNamed | ( | PDAtom | name | ) |
Creates a Named action with the specified name.
Some common named actions are NextPage, PrevPage, FirstPage, LastPage, which do what their names suggest. For more information refer to section 12.6.4.12 Named actions from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | name | The name of the action. |
| Action PDF::Document::CreateActionResetForm | ( | ) |
Creates a ResetForm action.
This action resets selected interactive form fields to their default values. For more information refer to section 12.7.6.3 Reset-form action from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| Action PDF::Document::CreateActionSubmitForm | ( | const std::string & | serverUri | ) |
Creates a SubmitForm action with the specified server URI.
This action can be to transmit the names and values of selected interactive form fields to a specified uniform resource locator. For more information refer to section 12.7.6.2 Submit-form action from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | serverUri | A reference to the server URI for the action in wide character string format. |
| Action PDF::Document::CreateActionURI | ( | const std::string & | uri | ) |
Creates a URI action with the specified URI.
This action causes the URI to be resolved. For more information refer to section 12.6.4.8 URI actions from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | uri | A reference to the URI for the action in wide character string format. (i.e. L"https://example.com") |
| Object PDF::Document::CreateArrayObject | ( | bool | indirect | ) |
Creates an array object.
An array object is a one-dimensional collection of objects arranged sequentially. The array elements may be any combination of numbers, strings, dictionaries, or any other objects, including other arrays. For more information refer to section 7.3.6 Array objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | indirect | Indicates whether the object is indirect. |
| Object PDF::Document::CreateBoolObject | ( | bool | value, |
| bool | indirect = false ) |
Creates a boolean value object.
For more information refer to section 7.3.2 Boolean objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | value | The value of the boolean object. |
| [in] | indirect | Indicates whether the object is indirect. |
| Dest PDF::Document::CreateDestFit | ( | size_t | pageIndex, |
| bool | isRemote = false ) |
Creates a destination that fits the entire page.
Fits the entire page within the window both horizontally and vertically. For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /Fit
| [in] | pageIndex | The specific page to be displayed. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestFitB | ( | size_t | pageIndex, |
| bool | isRemote = false ) |
Creates a destination that fits the bounding box of the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitB
| [in] | pageIndex | The specific page to be displayed. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestFitBH | ( | size_t | pageIndex, |
| float | top, | ||
| bool | isRemote = false ) |
Creates a destination that fits the width of the bounding box of the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitBH
| [in] | pageIndex | The specific page to be displayed. |
| [in] | top | The vertical coordinate positioned at the top edge of the window. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestFitBV | ( | size_t | pageIndex, |
| float | left, | ||
| bool | isRemote = false ) |
Creates a destination that fits the height of the bounding box of the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitBV
| [in] | pageIndex | The specific page to be displayed. |
| [in] | left | The horizontal coordinate positioned at the left edge of the window. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestFitH | ( | size_t | pageIndex, |
| float | top, | ||
| bool | isRemote = false ) |
Creates a destination that fits the width of the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitH
| [in] | pageIndex | The specific page to be displayed. |
| [in] | top | The vertical coordinate positioned at the top edge of the window. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
Creates a destination that fits the specified rectangle on the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitR
| [in] | pageIndex | The specific page to be displayed. |
| [in] | rect | A reference to the rectangle to fit inside of. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestFitV | ( | size_t | pageIndex, |
| float | left, | ||
| bool | isRemote = false ) |
Creates a destination that fits the height of the page.
For more information refer to section 12.3.2.2 Explicit destinations, Table 149 — Destination syntax, /FitV
| [in] | pageIndex | The specific page to be displayed. |
| [in] | left | The horizontal coordinate positioned at the left edge of the window. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Dest PDF::Document::CreateDestXYZ | ( | size_t | pageIndex, |
| const PointF & | xy, | ||
| float | zoom, | ||
| bool | isRemote = false ) |
Creates a destination with XYZ coordinates and zoom level.
A destination defines a particular view of a document. For more information refer to section 12.3.2 Destinations and Table 149 — Destination syntax, /XYZ from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | pageIndex | The specific page to be displayed. |
| [in] | xy | A reference to the location of the document window. |
| [in] | zoom | The magnification factor. |
| [in] | isRemote | [Optional] Indicates whether the destination is at the current document. |
| Object PDF::Document::CreateDictObject | ( | bool | indirect | ) |
Creates a dictionary object.
The keys shall be direct objects, the values may be any kind of object, including another dictionary. A dictionary entry whose value is null shall be treated the same as if the entry does not exist. For more information refer to section 7.3.7 Dictionary objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | indirect | Indicates whether the object is indirect. |
| FileSpec PDF::Document::CreateEmbeddedFile | ( | const std::wstring & | path | ) |
Creates an embedded file with the specified path.
| [in] | path | A reference to the path of the embedded file in wide character string format (i.e. L"path/to/embedded/file") |
Creates a file attachment annotation with the specified file specification and rectangle. For more information refer to ISO 32000-2:2020 (PDF 2.0) 12.5.6.11 File attachment annotations.
| [in] | fileSpec | The file specification for the attachment. |
| [in] | rect | A rectangle in page coordinates that defines the position and size of the file attachment annotation. |
| FileSpec PDF::Document::CreateFileSpec | ( | PDAtom | fileSys, |
| const std::wstring & | path ) |
Creates a FileSpec with the specified file system and path.
| [in] | fileSys | The file system of the FileSpec. |
| [in] | path | A reference to the path of the FileSpec in wide character string format. |
| Font PDF::Document::CreateFontEmbeddedCopy | ( | const Font & | font, |
| PDEFontCreateFlags | createFlags = kPDEFontCreateFlagsDefault ) |
Creates an embedded copy of the specified font in the document.
| [in] | font | A reference to the font to create an embedded copy of. |
| [in] | createFlags | Flags that define additional options for font creation. |
| Font PDF::Document::CreateFontFromInfo | ( | const PDFontInfo & | fontInfo, |
| bool | forceSysFont = true, | ||
| PDEFontCreateFlags | createFlags = kPDEFontCreateFlagsDefault ) |
Creates a font in the document using the specified font information.
| [in] | fontInfo | A reference to the font information. This includes the font family (Times New Roman, Arial etc.), format (i.e. TrueType TTF) and style (regular, bold, italic) For information on font formats refer to section 9.5 Introduction to font data structures and Table 108 — Font types from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| [in] | forceSysFont | [Optional] Indicates whether to force using system fonts (default: true). A flag used to determine whether to use a font that is installed on the system processing the PDF document. This maintains a uniform appearance across different documents and applications on the same system. |
| [in] | createFlags | Flags that define additional options for font creation. |
| FormField PDF::Document::CreateFormField | ( | const std::wstring & | fullname, |
| PDAtom | type, | ||
| PDFieldFlags | flags ) |
Creates a new form field with the specified name, type, and flags.
| [in] | fullname | A reference to the name of the form field in wide character string format. (i.e. L"email address") |
| [in] | type | The type of the form field. This can be a Button, Text, Choice or Signature. For more information refer to section 12.7.4 Field dictionaries, Table 226 — Entries common to all field dictionaries, key FT (Field Type). |
| [in] | flags | The flags defining the form field. Specifies the control, behavior and appearance of the form field. |
Creates a form XObject from the specified content stream.
A form XObject is a PDF content stream that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). For more information refer to sections 8.8 External objects and 8.10 Form XObjects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | content | The content stream used to create the form XObject. It is a sequence of instructions describing the graphical elements to be painted on a page. For more information refer to section 7.8.2 Content streams from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
Creates a free text annotation with the specified rectangle.
A free text annotation is always visible, because it has no open or closed state. It is not displayed in a popup window like an ordinary text annotation. For more information refer to section 12.5.6.6 Free text annotations from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | rect | A reference to the inner rectangle where the annotation’s text will be displayed. |
| Annot PDF::Document::CreateInkAnnot | ( | PDColorValue | color, |
| float | lineWidth, | ||
| const std::vector< std::vector< PointF > > & | points ) |
Creates an ink annotation with the specified color, line width, and points.
For more information refer to section 12.5.6.13 Ink annotations ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | color | The color of the ink annotation. |
| [in] | lineWidth | The line width of the ink annotation. |
| [in] | points | A reference to the coordinates that define the path of the ink annotation on the page. |
| Object PDF::Document::CreateIntObject | ( | int64_t | value, |
| bool | indirect = false ) |
Creates an integer value object.
For more information refer to section 7.3.3 Numeric objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | value | The value of the integer object. |
| [in] | indirect | Indicates whether the object is indirect. |
Creates a link annotation with the specified rectangle and action.
For more information refer to section ISO 32000-2:2020, 12.5.6.5 Link annotations
| [in] | rect | A rectangle in page coordinates that defines the position and size of the link annotation. |
| [in] | action | The action to be performed when the link is activated. |
| Object PDF::Document::CreateNameObject | ( | PDAtom | value, |
| bool | indirect = false ) |
Creates a name object.
A name object is an atomic symbol uniquely defined by a sequence of any characters (8-bit values) except null (character code 0). For more information refer to section 7.3.5 Name objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | value | The value of the name object. |
| [in] | indirect | Indicates whether the object is indirect. |
| OCGroup PDF::Document::CreateOCGroup | ( | const std::wstring & | name | ) |
Creates an optional content group with the specified name.
An OC group is a dictionary representing a collection of graphics that can be selectively shown or hidden at runtime.
ISO 32000-2:2020, 8.11.2 Optional Content Groups ISO 32000-2:2020, 8.11.4 Configuring Optional Content
| [in] | name | The name of the optional content group. Wide character string format (e.g. L"OCGroupName"). |
Creates a new page at the specified index with the given media box.
| [in] | insertAt | The index at which to insert the new page. |
| [in] | mediaBox | The media box of the new page. For more information refer to section 14.11.2 Page boundaries from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| void PDF::Document::CreatePageFromIcon | ( | size_t | insertAt, |
| const Document & | iconDoc, | ||
| const XObject & | icon ) |
Creates a page from an icon.
| [in] | insertAt | The location at which to insert the page at. |
| [in] | iconDoc | A reference to the document containing the icon. |
| [in] | icon | A reference to the icon to create the page from. A form XObject is a PDF content stream that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). For more information refer to sections 8.8 External objects and 8.10 Form XObjects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| void PDF::Document::CreatePages | ( | size_t | insertAt, |
| size_t | count, | ||
| const RectF & | mediaBox ) |
Creates multiple pages starting at the specified index with the given media box.
| [in] | insertAt | The index at which to insert the new pages. |
| [in] | count | The number of pages to create. |
| [in] | mediaBox | The media box of the new pages. For more information refer to section 14.11.2 Page boundaries from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
Creates a pattern object in the document using the specified pattern shading. A shading pattern object is a PDF object that defines a smooth transition between colors.
| [in] | shading | The shading object used to create the pattern. |
| Pattern PDF::Document::CreatePatternTiling | ( | PDETilingPatternPaintType | paintType, |
| PDETilingPatternTilingType | tilingType, | ||
| const RectF & | bbox, | ||
| float | xStep, | ||
| float | yStep, | ||
| const Content & | content ) |
Creates a pattern object in the document using the specified pattern paint type.
A tiling pattern object is a PDF object that defines a repeating graphical element.
| [in] | paintType | The type of pattern paint to create. |
| [in] | tilingType | The type of tiling pattern to create. |
| [in] | bbox | The bounding box of the pattern. |
| [in] | xStep | The horizontal spacing between pattern cells. Shall not be zero. |
| [in] | yStep | The vertical spacing between pattern cells. Shall not be zero. |
| [in] | content | The content stream used to create the pattern. |
Creates a popup annotation with the specified rectangle.
A popup annotation is a child of another annotation and is used to display additional information or content related to the parent annotation. For more information refer to section 12.5.6.14 Popup annotations, from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | rect | A rectangle in page coordinates that defines the position and size of the popup annotation. |
| Object PDF::Document::CreateRealObject | ( | float | value, |
| bool | indirect = false ) |
Creates a real number object.
For more information refer to section 7.3.3 Numeric objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | value | The value of the real object. |
| [in] | indirect | Indicates whether the object is indirect. |
| Bookmark PDF::Document::CreateRootBookmark | ( | ) |
Creates a root bookmark for the document.
For more information see section 12.3.3 Document outline from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
Creates a (rubber) stamp annotation with the specified rectangle and appearance.
For more information refer to section 12.5.6.12 Rubber stamp annotations from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | rect | A reference to the inner rectangle where the annotation’s text will be displayed. |
| [in] | appearance | A reference to the external graphics object specifying the visual representation of the stamp annotation. |
| Object PDF::Document::CreateStreamObject | ( | std::span< const Byte > | data, |
| const Object & | attributesDict, | ||
| const Object & | encodeParms, | ||
| bool | encodeSource ) |
Creates a stream object.
For more information refer to section 7.3.8 Stream objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | data | The stream data bytes. Their size becomes the Length key inside the stream dictionary. For more information refer to Table 5 — Entries common to all stream dictionaries. |
| [in] | attributesDict | A reference to the dictionary object containing the stream attributes. |
| [in] | encodeParms | A reference to the dictionary object containing the encoding parameters. |
| [in] | encodeSource | Indicates whether to encode the source data. |
| Object PDF::Document::CreateStringObject | ( | const std::string & | bytes, |
| bool | hex = false, | ||
| bool | indirect = false ) |
Creates a string object from a byte string.
For more information refer to section 7.3.4 String objects and section 7.3.4.3 Hexadecimal strings from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | bytes | A reference to the byte string. |
| [in] | hex | [Optional] Indicates whether the byte string is in hexadecimal format |
| [in] | indirect | Indicates whether the object is indirect. |
| Object PDF::Document::CreateStringObjectUnicode | ( | const std::wstring & | unicode, |
| bool | indirect = false ) |
Creates a literal string object from a Unicode string.
For more information refer to section 7.3.4 String objects and section 7.3.4.2 Literal strings from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | unicode | A reference to the Unicode string in wide character string format. |
| [in] | indirect | Indicates whether the object is indirect. |
| StructTreeRoot PDF::Document::CreateStructTree | ( | ) |
Creates a logical structure tree for the document.
For more information refer to ISO 32000-2:2020, 14.7 Logical structure.
Creates a text annotation with the specified dimensions.
For more information refer to section 12.5 Annotations from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | rect | A rectangle in page coordinates that defines the position and size of the text annotation. |
| Annot PDF::Document::CreateTextMarkupAnnot | ( | PDAtom | type, |
| PDColorValue | color, | ||
| const QuadPoints & | quads ) |
Creates a text markup annotation with the specified type, color, and quad points.
For more information refer to section 12.5.6.2 Markup annotations ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | type | The type of the text markup annotation. |
| [in] | color | The color of the text markup annotation. |
| [in] | quads | A reference to the corners of the text markup annotation boundary. |
Creates a widget annotation for the specified form field.
A widget annotation is a graphical representation of a form field in a PDF document. For more information refer to section 12.7.4 Field types
| [in] | field | The form field for which the widget annotation is created. |
| [in] | rect | A rectangle in page coordinates that defines the position and size of the widget annotation. |
| void PDF::Document::DeletePage | ( | size_t | index | ) |
Deletes the page at the specified index.
| [in] | index | The index of the page to delete. |
| void PDF::Document::DeletePages | ( | const std::vector< size_t > & | pageIndexes, |
| ProgressMonitor * | mon = nullptr ) |
Deletes the pages within the specified range.
| [in] | pageIndexes | The indexes of the pages to delete. |
| [out] | mon | [Optional] A pointer to the progress monitor handle that displays the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
| void PDF::Document::EnumAttachments | ( | EnumProc | enumProc | ) | const |
Enumerates the attachments in the document.
| EnumProc | The type of the enumeration procedure. |
| [in] | enumProc | The enumeration procedure to be called for each attachment. |
| void PDF::Document::EnumDocLevelJSActions | ( | EnumProc | enumProc | ) | const |
Enumerates the document-level JavaScript actions.
| EnumProc | The type of the enumeration procedure. |
| [in] | enumProc | The enumeration procedure to be called for each JavaScript action. |
| void PDF::Document::EnumFonts | ( | EnumProc | enumProc, |
| ProgressMonitor * | mon = nullptr ) const |
Enumerates the fonts used in the document.
The enumeration walks the resources of every page, including the resources of the nested form XObjects, patterns and Type 3 glyph procedures, and reports every distinct font once.
| EnumProc | The type of the enumeration procedure. |
| enumProc | The enumeration procedure to be called for each font. Returning false from the procedure stops the enumeration. |
| mon | A progress monitor to track the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
| void PDF::Document::ExportFormFDF | ( | const std::filesystem::path & | path, |
| std::span< const FormField > | fields = std::span< const FormField >(), | ||
| bool | exclude = true ) |
Exports the form field values to a Forms Data Format (FDF) file.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | path | A path of the FDF file to create. |
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| std::vector< Byte > PDF::Document::ExportFormFDFToMemory | ( | std::span< const FormField > | fields = std::span< const FormField >(), |
| bool | exclude = true ) |
Exports the form field values to an in-memory Forms Data Format (FDF) buffer.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| void PDF::Document::ExportFormFDFToStream | ( | IWriteSink & | sink, |
| std::span< const FormField > | fields = std::span< const FormField >(), | ||
| bool | exclude = true ) |
Exports the form field values as FDF to a caller-supplied byte sink.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | sink | A byte sink the FDF content is written to. |
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| void PDF::Document::ExportFormXFDF | ( | const std::filesystem::path & | path, |
| std::span< const FormField > | fields = std::span< const FormField >(), | ||
| bool | exclude = true ) |
Exports the form field values to an XFDF (XML Forms Data Format) file.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | path | A path of the XFDF file to create. |
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| std::vector< Byte > PDF::Document::ExportFormXFDFToMemory | ( | std::span< const FormField > | fields = std::span< const FormField >(), |
| bool | exclude = true ) |
Exports the form field values to an in-memory XFDF (XML Forms Data Format) buffer.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| void PDF::Document::ExportFormXFDFToStream | ( | IWriteSink & | sink, |
| std::span< const FormField > | fields = std::span< const FormField >(), | ||
| bool | exclude = true ) |
Exports the form field values as XFDF to a caller-supplied byte sink.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | sink | A byte sink the XFDF content is written to. |
| [in] | fields | The fields the export is scoped to; empty (the default) means all fields. |
| [in] | exclude | When true (the default), exports all fields except fields; when false, exports only fields. |
| FormField PDF::Document::FindFormField | ( | const std::wstring & | fullname | ) | const |
Finds a form field with the specified full name.
| [in] | fullname | A reference to the name of the form field to retrieve, in wide character string format (i.e. L"email address"). |
| FileSpec PDF::Document::GetAttachment | ( | std::string_view | name | ) | const |
Gets the attachment with the specified name.
| [in] | name | A reference to the name of the attachment in wide character string format (i.e. L"FileAttachmentName") |
| std::string PDF::Document::GetAttachmentNameByIndex | ( | size_t | index | ) | const |
Gets the name of the attachment at the specified index.
| [in] | index | The index of the attachment. |
| PDDateTime PDF::Document::GetCreationDate | ( | ) | const |
Gets the creation date of the document.
Retrieved from the document's information dictionary CreationDate entry. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| Action PDF::Document::GetDocLevelJSAction | ( | std::string_view | name | ) | const |
Gets the document-level JavaScript action with the specified name.
| [in] | name | A reference to the name of the JavaScript action. |
| std::filesystem::path PDF::Document::GetFilePath | ( | ) | const |
Gets the file path of the document.
| uint64_t PDF::Document::GetFileSize | ( | ) | const |
Gets the file size of the document.
| PDVersion PDF::Document::GetFileVersion | ( | ) | const |
Gets the PDF version of the document.
| FormField PDF::Document::GetFormField | ( | size_t | index | ) | const |
Gets the form field at the specified index.
For more information refer to section 12.7 Forms from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | index | The index of the form field. |
| Object PDF::Document::GetInfoObject | ( | ) | const |
Gets the info object of the document.
This is the document information dictionary, which is used to represent document level metadata. It is located in the Info entry of the file trailer. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| std::wstring PDF::Document::GetInfoString | ( | PDAtom | infoDictKey | ) | const |
Gets the information string associated with the specified info string atom.
| [in] | infoDictKey | The Atom specifies what information string to retrieve from the document's information dictionary. The supported atoms: Author, Title, Subject, Keywords, Creator, Producer. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| PDDateTime PDF::Document::GetModDate | ( | ) | const |
Gets the modification date of the document.
Retrieved from the document's information dictionary ModDate entry. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| size_t PDF::Document::GetNumAttachments | ( | ) | const |
Gets the number of attachments in the document.
| size_t PDF::Document::GetNumFormFields | ( | ) | const |
Gets the number of form fields in the document.
For more information refer to section 12.7 Forms from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| size_t PDF::Document::GetNumOCAltConfigs | ( | ) | const |
Gets the number of alternate optional content configurations.
This counts the configurations in the /Configs array of the /OCProperties. For the default configuration in /D, use GetOCConfig.
ISO 32000-2:2020, 8.11.4.3 Optional content configuration dictionaries
| size_t PDF::Document::GetNumOCGroups | ( | ) | const |
Gets the number of optional content groups in the document.
ISO 32000-2:2020, 8.11.2 Optional Content Groups
| size_t PDF::Document::GetNumOutputIntents | ( | ) | const |
Gets the number of Output Intents in the document.
| size_t PDF::Document::GetNumPages | ( | ) | const |
Gets the number of pages in the document.
| Object PDF::Document::GetObjectByID | ( | uint32_t | id | ) | const |
Gets the indirect object with the specified ID.
For more information refer to section 7.3 Objects from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | id | The ID of the object. |
| OCConfig PDF::Document::GetOCAltConfig | ( | size_t | index | ) | const |
Gets the alternate optional content configuration at the given index.
This returns the configuration at the index in the /Configs array of the /OCProperties. For the default configuration in /D, use GetOCConfig.
ISO 32000-2:2020, 8.11.4.3 Optional content configuration dictionaries
| [in] | index | The zero-based index into the /Configs array. |
| OCConfig PDF::Document::GetOCConfig | ( | ) | const |
Gets the document's default optional content configuration.
Optional content refers to sections of content in a PDF document that can be selectively viewed or hidden by document authors or consumers.
ISO 32000-2:2020, 8.11 Optional Content ISO 32000-2:2020, 8.11.4 Configuring optional content ISO 32000-2:2020, 8.11.4.3 Optional content configuration dictionaries
This returns the default viewing optional content configuration (the /D dictionary of the /OCProperties). For the alternate configurations in /Configs, use GetNumOCAltConfigs and GetOCAltConfig.
An OCContext created from this configuration (OCContext::Create) can be used to initialize a context representing the document's default visibility state, typically used as the baseline for rendering and content enumeration.
| OCGroup PDF::Document::GetOCGroup | ( | size_t | index | ) | const |
Gets the optional content group at the specified index.
ISO 32000-2:2020, 8.11.2 Optional Content Groups
| [in] | index | The zero-based index of the optional content group. |
| Action PDF::Document::GetOpenAction | ( | ) | const |
Gets the open action of the document.
| Dest PDF::Document::GetOpenDestination | ( | ) | const |
Gets the open destination of the document.
| OutputIntent PDF::Document::GetOutputIntent | ( | size_t | index | ) | const |
Gets an Output Intent by index.
| [in] | index | The zero‑based index into the Catalog’s OutputIntents array. |
| Page PDF::Document::GetPage | ( | size_t | index | ) | const |
Gets the page at the specified index.
| [in] | index | The index of the page. |
| PDPageDirection PDF::Document::GetPageDirection | ( | ) | const |
Gets the page direction of the document.
Retrieves the reading and writing order of text on a page. It can be either left to right (i.e. for English) or right to left (i.e. for Arabic). For more information refer to section 12.2 Viewer preferences Table 147 — Entries in a viewer preferences dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| PDAtom PDF::Document::GetPageLayout | ( | ) | const |
Gets the page layout of the document.
Retrieves the details about how a document's pages are displayed, when first opened. There are six possible layouts - one page at a time, pages in a column etc. For more information refer to section 7.7.2 Document catalog dictionary table Table 29 — Entries in the catalog dictionary, key PageLayout from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| PDAtom PDF::Document::GetPageMode | ( | ) | const |
Gets the page mode of the document.
This retrieves what a document's menu bar/sidebar is set to display, when a document is first opened. This could be the document's outline, thumbnails or attachments panel etc. For more information refer to section 7.7.2 Document catalog dictionary table Table 29 — Entries in the catalog dictionary, key PageMode from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| PDFAFlavor PDF::Document::GetPDFAFlavor | ( | ) | const |
Gets the PDF/A flavor of the document according to its XMP metadata.
| Bookmark PDF::Document::GetRootBookmark | ( | ) | const |
Gets the root bookmark of the document.
This is the root of the tree-structured hierarchy of the document's outline items (bookmarks). For more information see section 12.3.3 Document outline from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| Object PDF::Document::GetRootObject | ( | ) | const |
Gets the root object of the document.
This is the document catalogue dictionary, which is the root of a document's object heirarchy. It is located in the Root entry of the file trailer. For more information refer to section 7.7.2 Document catalog dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| StdSecurityParams PDF::Document::GetStandardSecurityParams | ( | ) | const |
Gets the standard security parameters of the document.
These include the editing, printing and data extraction permissions as well as owner and user password properties. For more information on Security Parameters refer to section 7.6.4 Standard security handler from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| StructTreeRoot PDF::Document::GetStructTree | ( | ) | const |
Gets the document's logical structure tree.
For more information refer to ISO 32000-2:2020, 14.7 Logical structure.
| std::string PDF::Document::GetXmpMetadata | ( | ) | const |
| void PDF::Document::ImportFormFDF | ( | const std::filesystem::path & | path | ) |
Imports form field values from a Forms Data Format (FDF) file.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | path | The path of the FDF file to read. |
| void PDF::Document::ImportFormFDFFromMemory | ( | std::span< const Byte > | data | ) |
Imports form field values from an in-memory Forms Data Format (FDF) buffer.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | data | The FDF content to read. |
| void PDF::Document::ImportFormFDFFromStream | ( | IDataSource & | source | ) |
Imports form field values from an FDF byte source.
See ISO 32000-2:2020, 12.7.8 Forms data format (FDF).
| [in] | source | The byte source the FDF content is read from; the whole source is read before importing. |
| void PDF::Document::ImportFormXFDF | ( | const std::filesystem::path & | path | ) |
Imports form field values from an XFDF (XML Forms Data Format) file.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | path | A path of the XFDF file to read. |
| void PDF::Document::ImportFormXFDFFromMemory | ( | std::span< const Byte > | data | ) |
Imports form field values from an in-memory XFDF (XML Forms Data Format) buffer.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | data | The XFDF content to read. |
| void PDF::Document::ImportFormXFDFFromStream | ( | IDataSource & | source | ) |
Imports form field values from an XFDF byte source.
See ISO 19444-1:2019, XML Forms Data Format (XFDF).
| [in] | source | The byte source the XFDF content is read from; the whole source is read before importing. |
| XObject PDF::Document::ImportIcon | ( | const Document & | source, |
| size_t | pageIndex = 0 ) |
Imports an icon from another document.
An icon is the visual representation of any of the annotation types when they are not interacted with. It represents the existence and location for an annotation and contains clues as to the type of annotation (i.e. a sound annotation will have a speaker displayed).
| [in] | source | A reference to the source document. |
| [in] | pageIndex | [Optional] The index of the page containing the icon (Default is 0). |
| void PDF::Document::InsertPage | ( | const Page & | page, |
| size_t | insertAt ) |
Inserts a page at the specified index.
| [in] | page | A reference to the page to insert. |
| [in] | insertAt | The index at which to insert the page. |
| void PDF::Document::InsertPages | ( | size_t | insertAt, |
| const Document & | sourceDoc, | ||
| const std::vector< size_t > & | sourcePageIndexes = {}, | ||
| ProgressMonitor * | mon = nullptr ) |
Inserts pages from another document into the current document.
| [in] | insertAt | The index at which to insert the pages. |
| [in] | sourceDoc | A reference to the source document from which to insert the pages. |
| [in] | sourcePageIndexes | The indexes of the pages to insert from the source document. Pass an empty vector to insert all pages. |
| [out] | mon | [Optional] A pointer to the progress monitor handle that displays the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
| bool PDF::Document::IsCompressed | ( | ) | const |
Checks if the document is compressed.
| bool PDF::Document::IsEncrypted | ( | ) | const |
Checks if the document is encrypted.
For more information refer to section 7.6 Security handlers from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| bool PDF::Document::IsModified | ( | ) | const |
Checks if the document has been modified.
| bool PDF::Document::IsRepaired | ( | ) | const |
Allows to check if the document was repaired during the opening process.
| bool PDF::Document::IsSigned | ( | ) | const |
Checks if the document is signed.
For further information refer to section 12.7.5.5 Signature fields from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| bool PDF::Document::IsTaggedPDF | ( | ) | const |
Checks if the PDF document is a tagged PDF.
Tagged PDFs contain additional structural information that enhances accessibility and reflow capabilities. For more information refer to section 14.6 Tagged PDF from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| void PDF::Document::MovePages | ( | size_t | insertAt, |
| const std::vector< size_t > & | pageIndexes, | ||
| ProgressMonitor * | mon = nullptr ) |
Moves pages within the document to a new position.
| [in] | insertAt | The index at which to insert the moved pages. |
| [in] | pageIndexes | The indexes of the pages to move. |
| [out] | mon | [Optional] A pointer to the progress monitor handle that displays the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
|
static |
Creates a new PDF document.
The new document will contain a single page with the specified media box.
| [in] | mediaBox | The media box of the new page. |
|
static |
Opens a PDF file from the specified path.
| [in] | path | A path to the PDF file to open. |
| [in] | password | A password for opening the PDF document, if it is encrypted. |
|
static |
Opens a PDF file from a memory buffer.
| [in] | data | The memory buffer containing the PDF file data. |
| [in] | copy | A flag to indicate if the data should be copied. If set to false, the buffer must remain valid until the document is closed. |
| [in] | password | A password for opening the PDF document, if it is encrypted. |
|
static |
Opens a PDF file from a caller-supplied data source.
| [in] | source | The random-access byte source to read the PDF from. The document shares ownership of source, reads from it on demand, and releases its reference when the document is closed. |
| [in] | password | A password for opening the PDF document, if it is encrypted. |
| ReadStream PDF::Document::OpenXfaStream | ( | ) | const |
Opens an XFA (XML Forms Architecture) stream.
An XFA stream is the object that contains the XML data describing an XFA form. For more information refer to Annex K (normative) XFA Forms from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| void PDF::Document::RemoveAttachment | ( | std::string_view | name | ) |
Removes the attachment with the specified name.
| [in] | name | A reference to the name of the attachment to remove in wide character string format (i.e. L"FileAttachmentName"). |
| void PDF::Document::RemoveFormField | ( | FormField | field | ) |
Removes the specified form field from the document.
For more information refer to section 12.7 Forms from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | field | The form field to remove. |
| void PDF::Document::RemoveOutputIntent | ( | const OutputIntent & | oi | ) |
Removes an Output Intent from the document.
| [in] | oi | The Output Intent to remove from the Catalog’s OutputIntents array. |
| void PDF::Document::RemoveStructTree | ( | ) |
Removes the document's logical structure tree.
For more information refer to ISO 32000-2:2020, 14.7 Logical structure.
| void PDF::Document::RenameFormField | ( | FormField | field, |
| const std::wstring & | fullname ) |
Renames a specified form field.
| [in] | field | The form field to retrieve and rename. |
| [in] | fullname | A reference to the new name of the form field, in wide character string format. (i.e. L"email address") |
| bool PDF::Document::RequestPermission | ( | PDPermReqObj | object, |
| PDPermReqOp | operation, | ||
| const std::wstring & | password = std::wstring() ) const |
Requests permission to perform an operation on the document. Permissions can be set either by the document's security handler or by the DocMDP.
| [in] | object | The object to request permission for. |
| [in] | operation | The operation to request permission for. |
| [in] | password | The password to use for the authorization. |
| void PDF::Document::ResetForm | ( | std::span< const FormField > | fields = std::span< const FormField >(), |
| PDResetFormFlags | flags = kPDResetFormFlagExclude ) |
Resets form fields to their default values.
For more information refer to section 12.7.6.3 Reset-form action from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | fields | The form fields the reset is scoped to. An empty list (the default), together with the default flags, resets every field in the form. |
| [in] | flags | Controls how fields is interpreted. When kPDResetFormFlagExclude is set (the default), the listed fields are excluded and all remaining fields are reset; when clear, only the listed fields are reset. |
| void PDF::Document::Save | ( | const std::filesystem::path & | path, |
| PDDocSaveFlags | flags = kPDDocSaveFull|kPDDocSaveCompressed, | ||
| ProgressMonitor * | progmon = nullptr, | ||
| const PDOptSaveSettings * | optSettings = nullptr, | ||
| const PDVersion * | version = nullptr ) |
Saves the document to a file.
| [in] | path | The full or relative path to the location where you want the PDF file saved. |
| [in] | flags | [Optional] An integer that specifies the type of save. For more information refer to the PDF Standard ISO 32000-2:2020 (PDF 2.0) sections: 12.8 - Digital Signatures p.575, Annex F - Linearized PDF and 7.5 File Structure respectively. PDDocSaveFlagsBits |
| [out] | progmon | [Optional] A pointer to the progress monitor handle that displays the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
| [in] | optSettings | [Optional] Options for level of PDF image quality and saving/removing of PDF structure internals. If not provided, defaults to a null pointer. PDOptSaveSettings |
| [in] | version | [Optional] Major and Minor version of the PDF file type. The convention being Major.Minor i.e. PDF 2.0 For more information refer to the PDF Standard ISO 32000-2:2020 (PDF 2.0) Annex I - PDF versions and compatibility. If not provided, defaults to a null pointer. |
| void PDF::Document::SaveSignedVersion | ( | FormField | sigField, |
| const std::filesystem::path & | path ) const |
Writes to a file the version of the document as it was at the time of signing.
| [in] | sigField | The signature field that was used to sign the document. |
| [in] | path | The path to the location where you want the signed version of the document saved. |
| void PDF::Document::SaveToStream | ( | IWriteSink & | sink, |
| PDDocSaveFlags | flags = kPDDocSaveFull|kPDDocSaveCompressed, | ||
| ProgressMonitor * | progmon = nullptr, | ||
| const PDOptSaveSettings * | optSettings = nullptr, | ||
| const PDVersion * | version = nullptr ) |
Saves the document to a caller-supplied sink.
| [in] | sink | The byte sink to write the serialized document to. |
| [in] | flags | [Optional] An integer that specifies the type of save. PDDocSaveFlagsBits Saving to a sink always performs a copy-style save, so kPDDocSaveCopy is applied implicitly. |
| [out] | progmon | [Optional] A pointer to the progress monitor handle that displays the progress/state of the operation. If not provided, defaults to a null pointer. ProgressMonitor |
| [in] | optSettings | [Optional] Options for level of PDF image quality and saving/removing of PDF structure internals. If not provided, defaults to a null pointer. PDOptSaveSettings |
| [in] | version | [Optional] Major and Minor version of the PDF file type. If not provided, defaults to a null pointer. |
| void PDF::Document::SetCreationDate | ( | const PDDateTime & | date | ) |
Sets the creation date of the document.
Set into the document's information dictionary CreationDate entry. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | date | A reference to the creation date to set. For format details refer to section 7.9.4 Dates from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| void PDF::Document::SetInfoString | ( | PDAtom | infoDictKey, |
| const std::wstring & | infoValue ) |
Sets the information string associated with the specified info string atom.
| [in] | infoDictKey | The Atom specifies what information string to set inside the document's information dictionary. The supported atoms: Author, Title, Subject, Keywords, Creator, Producer. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| [in] | infoValue | A reference to the information string to set. If empty, dict entry will be removed. (i.e. set infoDictKey = Author to infoValue = L"Author Name") |
| void PDF::Document::SetModDate | ( | const PDDateTime & | date | ) |
Sets the modification date of the document.
Set into the document's information dictionary ModDate entry. For more information refer to section 14.3.3 Document information dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | date | The modification date to set. For format details refer to section 7.9.4 Dates from the ISO 32000-2:2020 (PDF 2.0) PDF Standard. |
| void PDF::Document::SetModified | ( | bool | modified | ) |
Sets the state of the document to modified.
| [in] | modified | The modified flag to set the state. |
| void PDF::Document::SetOCConfig | ( | const OCConfig & | config | ) |
Sets the document's default optional content configuration.
This stores config as the default viewing configuration (the /D dictionary of the /OCProperties), replacing any existing default. The configuration must belong to this document; importing a configuration from another document is not supported.
ISO 32000-2:2020, 8.11.4.3 Optional content configuration dictionaries
| [in] | config | The optional content configuration to set as the default. It must originate from this document, otherwise the call fails with kPDErrBadParam. |
| void PDF::Document::SetOpenAction | ( | Action | action | ) |
Sets the open action for the document.
This defines an action that should be executed automatically when the PDF document is opened
| [in] | action | The action executed at document opening. |
| void PDF::Document::SetOpenDestination | ( | Dest | dest | ) |
Sets the open destination for the document.
| [in] | dest | The destination to set as the open destination. |
| void PDF::Document::SetPageDirection | ( | PDPageDirection | direction | ) |
Sets the page direction of the document.
This specifies reading and writing order of text on a page. The two possible directions are left to right for English, Spanish, Chinese, and most Western languages and right to left for Arabic, Hebrew, Persian etc. For more information refer to section 12.2 Viewer preferences Table 147 — Entries in a viewer preferences dictionary from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | direction | The page direction to set. |
| void PDF::Document::SetPageLayout | ( | PDAtom | layout | ) |
Sets the page layout of the document.
This defines how a document's pages are displayed, when first opened. There are six possible layouts - one page at a time, pages in a column etc. For more information refer to section 7.7.2 Document catalog dictionary table Table 29 — Entries in the catalog dictionary, key PageLayout from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | layout | The page layout to set. |
| void PDF::Document::SetPageMode | ( | PDAtom | mode | ) |
Sets the page mode of the document.
This defines what a document's menu bar/sidebar displays, when a document is first opened. The document's outline, thumbnails or attachments panel can be made visible among others. For more information refer to section 7.7.2 Document catalog dictionary table Table 29 — Entries in the catalog dictionary, key PageMode from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | mode | The page mode to set. |
| void PDF::Document::SetStandardSecurityParams | ( | const StdSecurityParams & | requestedParams | ) |
Sets the standard security parameters of the document.
These include the editing, printing and data extraction permissions as well as owner and user password properties. For more information on Security Parameters refer to section 7.6.4 Standard security handler from the ISO 32000-2:2020 (PDF 2.0) PDF Standard.
| [in] | requestedParams | A reference to the standard security parameters to set. |
| void PDF::Document::SetXmpMetadata | ( | const std::string & | xmpPacket | ) |
Sets XMP metadata packet for document.
| xmpPacket | XMP packet |
| PDF::Exception | on error. |