PoDoFo 0.9.6
|
#include <PdfDocument.h>
Public Member Functions | |
virtual | ~PdfDocument () |
virtual EPdfWriteMode | GetWriteMode () const =0 |
virtual EPdfVersion | GetPdfVersion () const =0 |
virtual bool | IsLinearized () const =0 |
PdfInfo * | GetInfo () const |
PdfOutlines * | GetOutlines (bool bCreate=ePdfCreateObject) |
PdfNamesTree * | GetNamesTree (bool bCreate=ePdfCreateObject) |
PdfAcroForm * | GetAcroForm (bool bCreate=ePdfCreateObject, EPdfAcroFormDefaulAppearance eDefaultAppearance=ePdfAcroFormDefaultAppearance_BlackText12pt) |
PdfPagesTree * | GetPagesTree () const |
int | GetPageCount () const |
PdfPage * | GetPage (int nIndex) const |
PdfFont * | CreateFont (const char *pszFontName, bool bSymbolCharset=false, const PdfEncoding *const pEncoding=PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), PdfFontCache::EFontCreationFlags eFontCreationFlags=PdfFontCache::eFontCreationFlags_AutoSelectBase14, bool bEmbedd=true) |
PdfFont * | CreateFont (const char *pszFontName, bool bBold, bool bItalic, bool bSymbolCharset=false, const PdfEncoding *const pEncoding=PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), PdfFontCache::EFontCreationFlags eFontCreationFlags=PdfFontCache::eFontCreationFlags_AutoSelectBase14, bool bEmbedd=true, const char *pszFileName=NULL) |
PdfFont * | CreateFont (FT_Face face, bool bSymbolCharset=false, const PdfEncoding *const pEncoding=PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), bool bEmbedd=true) |
PdfFont * | CreateDuplicateFontType1 (PdfFont *pFont, const char *pszSuffix) |
PdfFont * | CreateFontSubset (const char *pszFontName, bool bBold, bool bItalic, bool bSymbolCharset=false, const PdfEncoding *const pEncoding=PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), const char *pszFileName=NULL) |
FT_Library | GetFontLibrary () const |
void | EmbedSubsetFonts () |
PdfPage * | CreatePage (const PdfRect &rSize) |
void | CreatePages (const std::vector< PdfRect > &vecSizes) |
PdfPage * | InsertPage (const PdfRect &rSize, int atIndex) |
const PdfDocument & | Append (const PdfMemDocument &rDoc, bool bAppendAll=true) |
const PdfDocument & | InsertExistingPageAt (const PdfMemDocument &rDoc, int nPageIndex, int nAtIndex) |
PdfRect | FillXObjectFromDocumentPage (PdfXObject *pXObj, const PdfMemDocument &rDoc, int nPage, bool bUseTrimBox) |
PdfRect | FillXObjectFromExistingPage (PdfXObject *pXObj, int nPage, bool bUseTrimBox) |
PdfRect | FillXObjectFromPage (PdfXObject *pXObj, const PdfPage *pPage, bool bUseTrimBox, unsigned int difference) |
void | AttachFile (const PdfFileSpec &rFileSpec) |
PdfFileSpec * | GetAttachment (const PdfString &rName) |
void | AddNamedDestination (const PdfDestination &rDest, const PdfString &rsName) |
void | SetPageMode (EPdfPageMode inMode) |
EPdfPageMode | GetPageMode (void) const |
void | SetUseFullScreen (void) |
void | SetPageLayout (EPdfPageLayout inLayout) |
void | SetHideToolbar (void) |
void | SetHideMenubar (void) |
void | SetHideWindowUI (void) |
void | SetFitWindow (void) |
void | SetCenterWindow (void) |
void | SetDisplayDocTitle (void) |
void | SetPrintScaling (PdfName &inScalingType) |
void | SetBaseURI (const std::string &inBaseURI) |
void | SetLanguage (const std::string &inLanguage) |
void | SetBindingDirection (PdfName &inDirection) |
virtual bool | IsPrintAllowed () const =0 |
virtual bool | IsEditAllowed () const =0 |
virtual bool | IsCopyAllowed () const =0 |
virtual bool | IsEditNotesAllowed () const =0 |
virtual bool | IsFillAndSignAllowed () const =0 |
virtual bool | IsAccessibilityAllowed () const =0 |
virtual bool | IsDocAssemblyAllowed () const =0 |
virtual bool | IsHighPrintAllowed () const =0 |
PdfVecObjects * | GetObjects () |
const PdfVecObjects * | GetObjects () const |
void | SetFontConfigWrapper (const PdfFontConfigWrapper &rFontConfig) |
Protected Member Functions | |
PdfDocument (bool bEmpty=false) | |
void | SetInfo (PdfInfo *pInfo) |
PdfObject * | GetCatalog () |
const PdfObject * | GetCatalog () const |
void | SetCatalog (PdfObject *pObject) |
PdfObject * | GetTrailer () |
const PdfObject * | GetTrailer () const |
void | SetTrailer (PdfObject *pObject) |
PdfObject * | GetNamedObjectFromCatalog (const char *pszName) const |
void | InitPagesTree () |
void | FixObjectReferences (PdfObject *pObject, int difference) |
void | SetViewerPreference (const PdfName &whichPref, const PdfObject &valueObj) |
void | SetViewerPreference (const PdfName &whichPref, bool inValue) |
void | Clear () |
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
bEmpty | if true NO default objects (such as catalog) are created. |
void PoDoFo::PdfDocument::AddNamedDestination | ( | const PdfDestination & | rDest, |
const PdfString & | rsName | ||
) |
Adds a PdfDestination into the global Names tree with the specified name, optionally replacing one of the same name.
rDest | the destination to be assigned |
rsName | the name for the destination |
const PdfDocument & PoDoFo::PdfDocument::Append | ( | const PdfMemDocument & | rDoc, |
bool | bAppendAll = true |
||
) |
Appends another PdfDocument to this document.
rDoc | the document to append |
bAppendAll | specifies whether pages and outlines are appended too |
void PoDoFo::PdfDocument::AttachFile | ( | const PdfFileSpec & | rFileSpec | ) |
Attach a file to the document.
rFileSpec | a file specification |
|
protected |
Clear all internal variables and reset PdfDocument to an intial state.
Creates a duplicate Type1 PdfFont with a new ID
pFont | is the existing font |
pszSuffix | Suffix to add to font ID The returned object is owned by the PdfDocument. |
TODO: DS: Make this generic so that it will work for any font type!
PdfFont * PoDoFo::PdfDocument::CreateFont | ( | const char * | pszFontName, |
bool | bBold, | ||
bool | bItalic, | ||
bool | bSymbolCharset = false , |
||
const PdfEncoding *const | pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance() , |
||
PdfFontCache::EFontCreationFlags | eFontCreationFlags = PdfFontCache::eFontCreationFlags_AutoSelectBase14 , |
||
bool | bEmbedd = true , |
||
const char * | pszFileName = NULL |
||
) |
Creates a PdfFont object
pszFontName | name of the font as it is known to the system |
bBold | if true search for a bold font |
bItalic | if true search for an italic font |
bSymbolCharset | whether to use the symbol charset, rather than unicode charset |
pEncoding | the encoding of the font. The font will not take ownership of this object. |
eFontCreationFlags | special flag to specify how fonts should be created |
bEmbedd | specifies whether this font should be embedded in the PDF file. Embedding fonts is usually a good idea. |
pszFileName | path to a valid font file |
PdfFont * PoDoFo::PdfDocument::CreateFont | ( | const char * | pszFontName, |
bool | bSymbolCharset = false , |
||
const PdfEncoding *const | pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance() , |
||
PdfFontCache::EFontCreationFlags | eFontCreationFlags = PdfFontCache::eFontCreationFlags_AutoSelectBase14 , |
||
bool | bEmbedd = true |
||
) |
Creates a PdfFont object
pszFontName | name of the font as it is known to the system |
bSymbolCharset | whether to use the symbol charset, rather than unicode charset |
pEncoding | the encoding of the font. The font will not take ownership of this object. |
eFontCreationFlags | special flag to specify how fonts should be created |
bEmbedd | specifies whether this font should be embedded in the PDF file. Embedding fonts is usually a good idea. |
PdfFont * PoDoFo::PdfDocument::CreateFont | ( | FT_Face | face, |
bool | bSymbolCharset = false , |
||
const PdfEncoding *const | pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance() , |
||
bool | bEmbedd = true |
||
) |
Creates a PdfFont object
face | a valid freetype font handle (will be free()'d by PoDoFo) |
bSymbolCharset | whether to use the symbol charset, rather than unicode charset |
pEncoding | the encoding of the font. The font will not take ownership of this object. |
bEmbedd | specifies whether this font should be embedded in the PDF file. Embedding fonts is usually a good idea. |
PdfFont * PoDoFo::PdfDocument::CreateFontSubset | ( | const char * | pszFontName, |
bool | bBold, | ||
bool | bItalic, | ||
bool | bSymbolCharset = false , |
||
const PdfEncoding *const | pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance() , |
||
const char * | pszFileName = NULL |
||
) |
Creates a font subset which contains only a few characters and is embedded.
THIS WORKS ONLY FOR TTF FONTS!
pszFontName | name of the font as it is known to the system |
bBold | if true search for a bold font |
bItalic | if true search for an italic font |
bSymbolCharset | whether to use the symbol charset, rather than unicode charset |
pEncoding | the encoding of the font. The font will not take ownership of this object. |
pszFileName | optional path of a font file which should be used |
Creates a new page object and inserts it into the internal page tree. The returned page is owned by the PdfDocument and will get deleted along with it!
rSize | a PdfRect specifying the size of the page (i.e the /MediaBox key) in 1/1000th mm |
void PoDoFo::PdfDocument::CreatePages | ( | const std::vector< PdfRect > & | vecSizes | ) |
Creates several new page objects and inserts them into the internal page tree. The created pages are owned by the PdfDocument and will get deleted along with it!
vecSizes | a vector of PdfRect instances specifying the size of the pages (i.e the /MediaBox key) in PDF Units |
void PoDoFo::PdfDocument::EmbedSubsetFonts | ( | ) |
Embeds all pending subset fonts, is automatically done on Write(). Just call explicitly in case the PdfDocument is needed as PdfXObject.
PdfRect PoDoFo::PdfDocument::FillXObjectFromDocumentPage | ( | PdfXObject * | pXObj, |
const PdfMemDocument & | rDoc, | ||
int | nPage, | ||
bool | bUseTrimBox | ||
) |
Fill an existing empty PdfXObject from a page of another document. This will append the other document to this one.
pXObj | pointer to the PdfXObject |
rDoc | the document to embed into the PdfXObject |
nPage | number of page to embed into the PdfXObject |
bUseTrimBox | if true try to use page's TrimBox for size of PdfXObject |
PdfRect PoDoFo::PdfDocument::FillXObjectFromExistingPage | ( | PdfXObject * | pXObj, |
int | nPage, | ||
bool | bUseTrimBox | ||
) |
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.
pXObj | pointer to the PdfXObject |
nPage | number of page to embed into the PdfXObject |
bUseTrimBox | if true try to use page's TrimBox for size of PdfXObject |
PdfRect PoDoFo::PdfDocument::FillXObjectFromPage | ( | PdfXObject * | pXObj, |
const PdfPage * | pPage, | ||
bool | bUseTrimBox, | ||
unsigned int | 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.
pXObj | pointer to the PdfXObject |
pPage | pointer to the page to embed into PdfXObject |
bUseTrimBox | 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.
pObject | object to change |
difference | add this value to every reference that is encountered |
PdfAcroForm * PoDoFo::PdfDocument::GetAcroForm | ( | bool | bCreate = ePdfCreateObject , |
EPdfAcroFormDefaulAppearance | eDefaultAppearance = ePdfAcroFormDefaultAppearance_BlackText12pt |
||
) |
Get access to the AcroForm dictionary
bCreate | create the object if it does not exist (ePdfCreateObject) or return NULL if it does not exist |
eDefaultAppearance | specifies if a default appearence shall be created |
PdfFileSpec * PoDoFo::PdfDocument::GetAttachment | ( | const PdfString & | rName | ) |
Get an attached file's filespec.
rName | the name of the attachment |
|
inlineprotected |
Get access to the internal Catalog dictionary or root object.
|
inlineprotected |
Get access to the internal Catalog dictionary or root object.
|
inline |
Returns the font library from font cache
|
inline |
Get access to the internal Info dictionary You can set the author, title etc. of the document using the info dictionary.
|
protected |
Get a dictionary from the catalog dictionary by its name.
pszName | will be converted into a PdfName |
PdfNamesTree * PoDoFo::PdfDocument::GetNamesTree | ( | bool | bCreate = ePdfCreateObject | ) |
Get access to the Names dictionary (where all the named objects are stored) The returned PdfNamesTree object is owned by the PdfDocument.
bCreate | create the object if it does not exist (ePdfCreateObject) or return NULL if it does not exist |
|
inline |
Get access to the internal vector of objects or root object.
|
inline |
Get access to the internal vector of objects or root object.
PdfOutlines * PoDoFo::PdfDocument::GetOutlines | ( | bool | bCreate = ePdfCreateObject | ) |
Get access to the Outlines (Bookmarks) dictionary The returned outlines object is owned by the PdfDocument.
bCreate | create the object if it does not exist (ePdfCreateObject) or return NULL if it does not exist |
PdfPage * PoDoFo::PdfDocument::GetPage | ( | int | nIndex | ) | const |
Get the PdfPage for a specific page in a document The returned page is owned by the PdfDocument and will get deleted along with it!
nIndex | which page (0-based) |
int PoDoFo::PdfDocument::GetPageCount | ( | ) | const |
Get the total number of pages in a document
EPdfPageMode PoDoFo::PdfDocument::GetPageMode | ( | void | ) | const |
Gets the opening mode for a document.
|
inline |
Get access to the pages tree. Better use the GetPage() and CreatePage() methods.
|
pure virtual |
Get the PDF version of the document
Implemented in PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
|
inlineprotected |
Get access to the internal trailer dictionary or root object.
|
inlineprotected |
Get access to the internal trailer dictionary or root object.
|
pure virtual |
Get the write mode used for writing the PDF
Implemented in PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
|
protected |
Internal method for initializing the pages tree for this document
const PdfDocument & PoDoFo::PdfDocument::InsertExistingPageAt | ( | const PdfMemDocument & | rDoc, |
int | nPageIndex, | ||
int | nAtIndex | ||
) |
Inserts existing page from another PdfMemDocument to this document.
rDoc | the document to append from |
nPageIndex | index of page to append (0-based), from rDoc |
nAtIndex | index at which to add the page in this document |
Creates a new page object and inserts it at index atIndex. The returned page is owned by the pages tree and will get deleted along with it!
rSize | a PdfRect specifying the size of the page (i.e the /MediaBox key) in PDF units |
atIndex | index where to insert the new page (0-based) |
|
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 PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
|
pure virtual |
Checks if text and graphics extraction is allowed. Every PDF-consuming application has to adhere to this value!
Implemented in PoDoFo::PdfMemDocument, and PoDoFo::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 PoDoFo::PdfMemDocument, and PoDoFo::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 PoDoFo::PdfMemDocument, and PoDoFo::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 PoDoFo::PdfMemDocument, and PoDoFo::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 PoDoFo::PdfMemDocument, and PoDoFo::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 PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
|
pure virtual |
Returns whether this PDF document is linearized, aka web-optimized
Implemented in PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
|
pure virtual |
Checks if printing this document is allowed. Every PDF-consuming application has to adhere to this value!
Implemented in PoDoFo::PdfMemDocument, and PoDoFo::PdfStreamedDocument.
void PoDoFo::PdfDocument::SetBaseURI | ( | const std::string & | inBaseURI | ) |
Set the document's Viewer Preferences: Set the base URI of the document.
TODO: DS document value!
void PoDoFo::PdfDocument::SetBindingDirection | ( | PdfName & | inDirection | ) |
Set the document's Viewer Preferences: Set the document's binding direction.
|
inlineprotected |
Set the catalog of this PdfDocument deleting the old one.
pObject | the new catalog object It will be owned by PdfDocument. |
void PoDoFo::PdfDocument::SetCenterWindow | ( | void | ) |
Set the document's Viewer Preferences: Center the document in the viewer's window.
void PoDoFo::PdfDocument::SetDisplayDocTitle | ( | void | ) |
Set the document's Viewer Preferences: Display the title from the document information in the title of the viewer.
void PoDoFo::PdfDocument::SetFitWindow | ( | void | ) |
Set the document's Viewer Preferences: Fit the document in the viewer's window.
|
inline |
Set wrapper for the fontconfig library. Useful to avoid initializing Fontconfig multiple times.
This setter can be called until first use of Fontconfig as the library is initialized at first use.
void PoDoFo::PdfDocument::SetHideMenubar | ( | void | ) |
Set the document's Viewer Preferences: Hide the menubar in the viewer.
void PoDoFo::PdfDocument::SetHideToolbar | ( | void | ) |
Set the document's Viewer Preferences: Hide the toolbar in the viewer.
void PoDoFo::PdfDocument::SetHideWindowUI | ( | void | ) |
Set the document's Viewer Preferences: Show only the documents contents and no control elements such as buttons and scrollbars in the viewer.
|
protected |
Set the info object containing meta information. Deletes any old info object.
pInfo | the new info object (will be owned by PdfDocument) |
void PoDoFo::PdfDocument::SetLanguage | ( | const std::string & | inLanguage | ) |
Set the document's Viewer Preferences: Set the language of the document.
void PoDoFo::PdfDocument::SetPageLayout | ( | EPdfPageLayout | inLayout | ) |
Sets the page layout for a document.
void PoDoFo::PdfDocument::SetPageMode | ( | EPdfPageMode | inMode | ) |
Sets the opening mode for a document.
inMode | which mode to set |
void PoDoFo::PdfDocument::SetPrintScaling | ( | PdfName & | inScalingType | ) |
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.
pObject | the new trailer object It will be owned by PdfDocument. |
void PoDoFo::PdfDocument::SetUseFullScreen | ( | void | ) |
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 |