|
pdfmm 0.9.20
|
#include <PdfDocument.h>
Protected Member Functions | |
| PdfDocument (bool empty=false) | |
| void | SetTrailer (std::unique_ptr< PdfObject > obj) |
| void | Init () |
| void | FixObjectReferences (PdfObject &obj, int difference) |
| void | SetViewerPreference (const PdfName &whichPref, const PdfObject &valueObj) |
| void | SetViewerPreference (const PdfName &whichPref, bool inValue) |
| void | Clear () |
| PdfObject * | getCatalog () |
PdfDocument is the core interface for working with PDF documents.
PdfDocument provides easy access to the individual pages in the PDF file and to certain special dictionaries.
PdfDocument cannot be used directly. Use PdfMemDocument whenever you want to change the object structure of a PDF file.
When you are only creating PDF files, please use PdfStreamedDocument which is usually faster for creating PDFs.
|
virtual |
Close down/destruct the PdfDocument
|
protected |
Construct a new (empty) PdfDocument
| empty | if true NO default objects (such as catalog) are created. |
| void PdfDocument::AddNamedDestination | ( | const PdfDestination & | dest, |
| const PdfString & | name | ||
| ) |
Adds a PdfDestination into the global Names tree with the specified name, optionally replacing one of the same name.
| dest | the destination to be assigned |
| name | the name for the destination |
| const PdfDocument & PdfDocument::Append | ( | const PdfDocument & | doc, |
| bool | appendAll = true |
||
| ) |
Appends another PdfDocument to this document.
| doc | the document to append |
| appendAll | specifies whether pages and outlines are appended too |
| void PdfDocument::AttachFile | ( | const PdfFileSpec & | fileSpec | ) |
Attach a file to the document.
| rFileSpec | a file specification |
|
protected |
Clear all internal variables and reset PdfDocument to an intial state.
| void PdfDocument::EmbedSubsetFonts | ( | ) |
Embeds all pending subset fonts, is automatically done on Write(). Just call explicitly in case the PdfDocument is needed as PdfXObject.
| PdfRect PdfDocument::FillXObjectFromDocumentPage | ( | PdfXObject & | xobj, |
| const PdfDocument & | doc, | ||
| unsigned | pageIndex, | ||
| bool | useTrimBox | ||
| ) |
Fill an existing empty PdfXObject from a page of another document. This will append the other document to this one.
| xobj | pointer to the PdfXObject |
| doc | the document to embed into the PdfXObject |
| pageIndex | index of page to embed into the PdfXObject |
| useTrimBox | if true try to use page's TrimBox for size of PdfXObject |
| PdfRect PdfDocument::FillXObjectFromExistingPage | ( | PdfXObject & | xobj, |
| unsigned | pageIndex, | ||
| bool | useTrimBox | ||
| ) |
Fill an existing empty PdfXObject from an existing page from the current document. If you need a page from another document use FillXObjectFromDocumentPage(), or append the document manually.
| xobj | pointer to the PdfXObject |
| pageIndex | index of page to embed into the PdfXObject |
| useTrimBox | if true try to use page's TrimBox for size of PdfXObject |
| PdfRect PdfDocument::FillXObjectFromPage | ( | PdfXObject & | xobj, |
| const PdfPage & | page, | ||
| bool | useTrimBox, | ||
| unsigned | difference | ||
| ) |
Fill an existing empty PdfXObject from an existing page pointer from the current document. This is the implementation for FillXObjectFromDocumentPage() and FillXObjectFromExistingPage(), you should use those directly instead of this.
| xobj | pointer to the PdfXObject |
| page | pointer to the page to embed into PdfXObject |
| useTrimBox | if true try to use page's TrimBox for size of PdfXObject |
|
protected |
Recursively changes every PdfReference in the PdfObject and in any child that is either an PdfArray or a direct object. The reference is changed so that difference is added to the object number of the reference.
| obj | object to change |
| difference | add this value to every reference that is encountered |
| PdfFileSpec * PdfDocument::GetAttachment | ( | const PdfString & | name | ) |
Get an attached file's filespec.
| name | the name of the attachment |
| PdfObject & PdfDocument::GetCatalog | ( | ) |
Get access to the internal Catalog dictionary or root object.
|
inlineprotected |
Get access to the internal trailer dictionary or root object.
| const PdfObject & PdfDocument::GetCatalog | ( | ) | const |
Get access to the internal Catalog dictionary or root object.
| PdfInfo & PdfDocument::GetInfo | ( | ) |
Get access to the internal Info dictionary You can set the author, title etc. of the document using the info dictionary.
| const PdfInfo & PdfDocument::GetInfo | ( | ) | const |
Get access to the internal Info dictionary You can set the author, title etc. of the document using the info dictionary.
| PdfObject * PdfDocument::GetLanguage | ( | ) |
Get access to the RFC 3066 natural language id for the document (ISO 32000-1:2008 14.9.2.1)
| PdfObject * PdfDocument::GetMarkInfo | ( | ) |
Get access to the MarkInfo dictionary (ISO 32000-1:2008 14.7.1)
| PdfObject * PdfDocument::GetMetadata | ( | ) |
Get access to the Metadata stream
|
inline |
Get access to the internal vector of objects or root object.
|
inline |
Get access to the internal vector of objects or root object.
| PdfAcroForm & PdfDocument::GetOrCreateAcroForm | ( | PdfAcroFormDefaulAppearance | eDefaultAppearance = PdfAcroFormDefaulAppearance::BlackText12pt | ) |
Get access to the AcroForm dictionary
| create | create the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist |
| eDefaultAppearance | specifies if a default appearence shall be created |
| PdfNameTree & PdfDocument::GetOrCreateNameTree | ( | ) |
Get access to the Names dictionary (where all the named objects are stored) The returned PdfNameTree object is owned by the PdfDocument.
| create | create the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist |
| PdfOutlines & PdfDocument::GetOrCreateOutlines | ( | ) |
Get access to the Outlines (Bookmarks) dictionary The returned outlines object is owned by the PdfDocument.
| create | create the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist |
| PdfPageMode PdfDocument::GetPageMode | ( | ) | const |
Gets the opening mode for a document.
| PdfPageTree & PdfDocument::GetPageTree | ( | ) |
Get access to the pages tree.
| const PdfPageTree & PdfDocument::GetPageTree | ( | ) | const |
Get access to the pages tree.
|
pure virtual |
Get the PDF version of the document
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
| PdfObject * PdfDocument::GetStructTreeRoot | ( | ) |
Get access to the StructTreeRoot dictionary
| PdfObject & PdfDocument::GetTrailer | ( | ) |
Get access to the internal trailer dictionary or root object.
| const PdfObject & PdfDocument::GetTrailer | ( | ) | const |
Get access to the internal trailer dictionary or root object.
|
protected |
Internal method for initializing the pages tree for this document
| const PdfDocument & PdfDocument::InsertExistingPageAt | ( | const PdfDocument & | doc, |
| unsigned | pageIndex, | ||
| unsigned | atIndex | ||
| ) |
Inserts existing page from another PdfDocument to this document.
| doc | the document to append from |
| pageIndex | index of page to append from doc |
| atIndex | index at which to add the page in this document |
|
pure virtual |
Checks if it is allowed to extract text and graphics to support users with disabilities. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if text and graphics extraction is allowed. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if it is allowed to insert, create, rotate, or delete pages or add bookmarks. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if modifying this document (besides annotations, form fields or substituting pages) is allowed. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if it is allowed to add or modify annotations or form fields. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if it is allowed to fill in existing form or signature fields. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if it is allowed to print a high quality version of this document Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Returns whether this PDF document is linearized, aka web-optimized
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
|
pure virtual |
Checks if printing this document is allowed. Every PDF-consuming application has to adhere to this value!
Implemented in mm::PdfMemDocument, and mm::PdfStreamedDocument.
| void PdfDocument::SetBaseURI | ( | const std::string_view & | baseURI | ) |
Set the document's Viewer Preferences: Set the base URI of the document.
TODO: DS document value!
| void PdfDocument::SetBindingDirection | ( | const PdfName & | direction | ) |
Set the document's Viewer Preferences: Set the document's binding direction.
| void PdfDocument::SetCenterWindow | ( | ) |
Set the document's Viewer Preferences: Center the document in the viewer's window.
| void PdfDocument::SetDisplayDocTitle | ( | ) |
Set the document's Viewer Preferences: Display the title from the document information in the title of the viewer.
| void PdfDocument::SetFitWindow | ( | ) |
Set the document's Viewer Preferences: Fit the document in the viewer's window.
| void PdfDocument::SetHideMenubar | ( | ) |
Set the document's Viewer Preferences: Hide the menubar in the viewer.
| void PdfDocument::SetHideToolbar | ( | ) |
Set the document's Viewer Preferences: Hide the toolbar in the viewer.
| void PdfDocument::SetHideWindowUI | ( | ) |
Set the document's Viewer Preferences: Show only the documents contents and no control elements such as buttons and scrollbars in the viewer.
| void PdfDocument::SetLanguage | ( | const std::string_view & | language | ) |
Set the document's Viewer Preferences: Set the language of the document.
| void PdfDocument::SetPageLayout | ( | PdfPageLayout | inLayout | ) |
Sets the page layout for a document.
| void PdfDocument::SetPageMode | ( | PdfPageMode | inMode | ) |
Sets the opening mode for a document.
| inMode | which mode to set |
| void PdfDocument::SetPrintScaling | ( | const PdfName & | scalingType | ) |
Set the document's Viewer Preferences: Set the default print scaling of the document.
TODO: DS use an enum here!
|
protected |
Set the trailer of this PdfDocument deleting the old one.
| obj | the new trailer object It will be owned by PdfDocument. |
| void PdfDocument::SetUseFullScreen | ( | ) |
Sets the opening mode for a document to be in full screen.
|
protected |
Low-level APIs for setting a viewer preference. Convenience overload.
| whichPref | the dictionary key to set |
| inValue | the object to be set |