PoDoFo  1.0.0-dev
Public Member Functions | Protected Member Functions | Friends | List of all members
PoDoFo::PdfDocument Class Referenceabstract

PdfDocument is the core interface for working with PDF documents. More...

#include <PdfDocument.h>

Inheritance diagram for PoDoFo::PdfDocument:
PoDoFo::PdfMemDocument PoDoFo::PdfStreamedDocument

Public Member Functions

virtual ~PdfDocument ()
 Close down/destruct the PdfDocument.
 
PdfOutlinesGetOrCreateOutlines ()
 Get access to the Outlines (Bookmarks) dictionary The returned outlines object is owned by the PdfDocument. More...
 
PdfNameTreesGetOrCreateNames ()
 Get access to the Names dictionary (where all the named objects are stored) The returned PdfNameTrees object is owned by the PdfDocument. More...
 
PdfAcroForm & GetOrCreateAcroForm (PdfAcroFormDefaulAppearance eDefaultAppearance=PdfAcroFormDefaulAppearance::ArialBlack)
 Get access to the AcroForm dictionary. More...
 
void CollectGarbage ()
 
std::unique_ptr< PdfImageCreateImage ()
 Construct a new PdfImage object.
 
std::unique_ptr< PdfXObjectForm > CreateXObjectForm (const Rect &rect)
 
std::unique_ptr< PdfDestinationCreateDestination ()
 
std::unique_ptr< PdfColorSpace > CreateColorSpace (const PdfColorSpaceFilterPtr &filter)
 
std::unique_ptr< PdfExtGStateCreateExtGState ()
 
template<typename Taction >
std::unique_ptr< Taction > CreateAction ()
 
std::unique_ptr< PdfActionCreateAction (PdfActionType type)
 
std::unique_ptr< PdfFileSpecCreateFileSpec ()
 
bool IsPrintAllowed () const
 Checks if printing this document is allowed. More...
 
bool IsEditAllowed () const
 Checks if modifying this document (besides annotations, form fields or substituting pages) is allowed. More...
 
bool IsCopyAllowed () const
 Checks if text and graphics extraction is allowed. More...
 
bool IsEditNotesAllowed () const
 Checks if it is allowed to add or modify annotations or form fields. More...
 
bool IsFillAndSignAllowed () const
 Checks if it is allowed to fill in existing form or signature fields. More...
 
bool IsAccessibilityAllowed () const
 Checks if it is allowed to extract text and graphics to support users with disabilities. More...
 
bool IsDocAssemblyAllowed () const
 Checks if it is allowed to insert, create, rotate, or delete pages or add bookmarks. More...
 
bool IsHighPrintAllowed () const
 Checks if it is allowed to print a high quality version of this document Every PDF-consuming application has to adhere to this value! More...
 
PdfAcroForm & MustGetAcroForm ()
 
const PdfAcroForm & MustGetAcroForm () const
 
PdfNameTreesMustGetNames ()
 
const PdfNameTreesMustGetNames () const
 
PdfOutlinesMustGetOutlines ()
 
const PdfOutlinesMustGetOutlines () const
 
PdfDocumentFieldIterable GetFieldsIterator ()
 Get an iterator for all fields in the document. More...
 
PdfDocumentConstFieldIterable GetFieldsIterator () const
 
void Reset ()
 Clear all internal structures and reset PdfDocument to an empty state.
 
virtual const PdfEncryptGetEncrypt () const =0
 
bool IsEncrypted () const
 
PdfCatalog & GetCatalog ()
 Get access to the internal Catalog dictionary or root object. More...
 
const PdfCatalog & GetCatalog () const
 Get access to the internal Catalog dictionary or root object. More...
 
PdfPageCollectionGetPages ()
 Get access to the page tree. More...
 
const PdfPageCollectionGetPages () const
 Get access to the page tree. More...
 
PdfTrailer & GetTrailer ()
 Get access to the internal trailer dictionary or root object. More...
 
const PdfTrailer & GetTrailer () const
 Get access to the internal trailer dictionary or root object. More...
 
const PdfInfoGetInfo () const
 Get access to the internal Info dictionary You can set the author, title etc. More...
 
PdfMetadata & GetMetadata ()
 
const PdfMetadata & GetMetadata () const
 
PdfIndirectObjectListGetObjects ()
 Get access to the internal vector of objects or root object. More...
 
const PdfIndirectObjectListGetObjects () const
 Get access to the internal vector of objects or root object. More...
 
PdfAcroForm * GetAcroForm ()
 
const PdfAcroForm * GetAcroForm () const
 
PdfNameTreesGetNames ()
 
const PdfNameTreesGetNames () const
 
PdfOutlinesGetOutlines ()
 
const PdfOutlinesGetOutlines () const
 
PdfFontManagerGetFonts ()
 
template<typename TAction >
std::unique_ptr< TAction > CreateAction ()
 

Protected Member Functions

 PdfDocument (bool empty=false)
 Construct a new (empty) PdfDocument. More...
 
 PdfDocument (const PdfDocument &doc)
 
void SetTrailer (std::unique_ptr< PdfObject > obj)
 Set the trailer of this PdfDocument deleting the old one. More...
 
void Init ()
 Internal method for initializing the pages tree for this document.
 
virtual void reset ()
 
void Clear ()
 Clear all variables that have internal memory usage.
 
virtual void clear ()
 
virtual PdfVersion GetPdfVersion () const =0
 Get the PDF version of the document. More...
 
virtual void SetPdfVersion (PdfVersion version)=0
 Get the PDF version of the document. More...
 

Friends

class PdfMetadata
 
class PdfXObjectForm
 
class PdfPageCollection
 

Detailed Description

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.

See also
PdfStreamedDocument
PdfMemDocument

Constructor & Destructor Documentation

◆ PdfDocument()

PdfDocument::PdfDocument ( bool  empty = false)
protected

Construct a new (empty) PdfDocument.

Parameters
emptyif true NO default objects (such as catalog) are created.

Member Function Documentation

◆ GetCatalog() [1/2]

PdfCatalog& PoDoFo::PdfDocument::GetCatalog ( )
inline

Get access to the internal Catalog dictionary or root object.

Returns
PdfObject the documents catalog

◆ GetCatalog() [2/2]

const PdfCatalog& PoDoFo::PdfDocument::GetCatalog ( ) const
inline

Get access to the internal Catalog dictionary or root object.

Returns
PdfObject the documents catalog

◆ GetFieldsIterator()

PdfDocumentFieldIterable PdfDocument::GetFieldsIterator ( )

Get an iterator for all fields in the document.

All widget annotation fields in the pages will be returned, plus non annotation fields in the /AcroForm (eg. invisibile signatures)

◆ GetInfo()

const PdfInfo* PoDoFo::PdfDocument::GetInfo ( ) const
inline

Get access to the internal Info dictionary You can set the author, title etc.

of the document using the info dictionary.

Returns
the info dictionary

◆ GetObjects() [1/2]

PdfIndirectObjectList& PoDoFo::PdfDocument::GetObjects ( )
inline

Get access to the internal vector of objects or root object.

Returns
the vector of objects

◆ GetObjects() [2/2]

const PdfIndirectObjectList& PoDoFo::PdfDocument::GetObjects ( ) const
inline

Get access to the internal vector of objects or root object.

Returns
the vector of objects

◆ GetOrCreateAcroForm()

PdfAcroForm & PdfDocument::GetOrCreateAcroForm ( PdfAcroFormDefaulAppearance  eDefaultAppearance = PdfAcroFormDefaulAppearance::ArialBlack)

Get access to the AcroForm dictionary.

Parameters
createcreate the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist
eDefaultAppearancespecifies if a default appearance shall be created
Returns
PdfObject the AcroForm dictionary

◆ GetOrCreateNames()

PdfNameTrees & PdfDocument::GetOrCreateNames ( )

Get access to the Names dictionary (where all the named objects are stored) The returned PdfNameTrees object is owned by the PdfDocument.

Parameters
createcreate the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist
Returns
the Names dictionary

◆ GetOrCreateOutlines()

PdfOutlines & PdfDocument::GetOrCreateOutlines ( )

Get access to the Outlines (Bookmarks) dictionary The returned outlines object is owned by the PdfDocument.

Parameters
createcreate the object if it does not exist (ePdfCreateObject) or return nullptr if it does not exist
Returns
the Outlines/Bookmarks dictionary

◆ GetPages() [1/2]

PdfPageCollection& PoDoFo::PdfDocument::GetPages ( )
inline

Get access to the page tree.

Returns
the PdfPageTree of this document.

◆ GetPages() [2/2]

const PdfPageCollection& PoDoFo::PdfDocument::GetPages ( ) const
inline

Get access to the page tree.

Returns
the PdfPageTree of this document.

◆ GetPdfVersion()

virtual PdfVersion PoDoFo::PdfDocument::GetPdfVersion ( ) const
protectedpure virtual

Get the PDF version of the document.

Returns
PdfVersion version of the pdf document

Implemented in PoDoFo::PdfStreamedDocument, and PoDoFo::PdfMemDocument.

◆ GetTrailer() [1/2]

PdfTrailer& PoDoFo::PdfDocument::GetTrailer ( )
inline

Get access to the internal trailer dictionary or root object.

Returns
PdfObject the documents catalog

◆ GetTrailer() [2/2]

const PdfTrailer& PoDoFo::PdfDocument::GetTrailer ( ) const
inline

Get access to the internal trailer dictionary or root object.

Returns
PdfObject the documents catalog

◆ IsAccessibilityAllowed()

bool PdfDocument::IsAccessibilityAllowed ( ) const

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!

Returns
true if you are allowed to extract text and graphics to support users with disabilities
See also
PdfEncrypt to set own document permissions.

◆ IsCopyAllowed()

bool PdfDocument::IsCopyAllowed ( ) const

Checks if text and graphics extraction is allowed.

Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to extract text and graphics from this document
See also
PdfEncrypt to set own document permissions.

◆ IsDocAssemblyAllowed()

bool PdfDocument::IsDocAssemblyAllowed ( ) const

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!

Returns
true if you are allowed to insert, create, rotate, or delete pages or add bookmarks
See also
PdfEncrypt to set own document permissions.

◆ IsEditAllowed()

bool PdfDocument::IsEditAllowed ( ) const

Checks if modifying this document (besides annotations, form fields or substituting pages) is allowed.

Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to modify this document
See also
PdfEncrypt to set own document permissions.

◆ IsEditNotesAllowed()

bool PdfDocument::IsEditNotesAllowed ( ) const

Checks if it is allowed to add or modify annotations or form fields.

Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to add or modify annotations or form fields
See also
PdfEncrypt to set own document permissions.

◆ IsEncrypted()

bool PdfDocument::IsEncrypted ( ) const
Returns
true if this PdfMemDocument creates an encrypted PDF file

◆ IsFillAndSignAllowed()

bool PdfDocument::IsFillAndSignAllowed ( ) const

Checks if it is allowed to fill in existing form or signature fields.

Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to fill in existing form or signature fields
See also
PdfEncrypt to set own document permissions.

◆ IsHighPrintAllowed()

bool PdfDocument::IsHighPrintAllowed ( ) const

Checks if it is allowed to print a high quality version of this document Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to print a high quality version of this document
See also
PdfEncrypt to set own document permissions.

◆ IsPrintAllowed()

bool PdfDocument::IsPrintAllowed ( ) const

Checks if printing this document is allowed.

Every PDF-consuming application has to adhere to this value!

Returns
true if you are allowed to print this document
See also
PdfEncrypt to set own document permissions.

◆ SetPdfVersion()

virtual void PoDoFo::PdfDocument::SetPdfVersion ( PdfVersion  version)
protectedpure virtual

Get the PDF version of the document.

Returns
PdfVersion version of the pdf document

Implemented in PoDoFo::PdfStreamedDocument, and PoDoFo::PdfMemDocument.

◆ SetTrailer()

void PdfDocument::SetTrailer ( std::unique_ptr< PdfObject obj)
protected

Set the trailer of this PdfDocument deleting the old one.

Parameters
objthe new trailer object It will be owned by PdfDocument.

The documentation for this class was generated from the following files: