PoDoFo 0.9.6
PoDoFo::PdfPage Class Reference

#include <PdfPage.h>

Inheritance diagram for PoDoFo::PdfPage:
PoDoFo::PdfElement PoDoFo::PdfCanvas

Public Member Functions

 PdfPage (const PdfRect &rSize, PdfDocument *pParent)
 PdfPage (const PdfRect &rSize, PdfVecObjects *pParent)
 PdfPage (PdfObject *pObject, const std::deque< PdfObject * > &listOfParents)
virtual const PdfRect GetPageSize () const
bool SetPageWidth (int newWidth)
bool SetPageHeight (int newHeight)
void SetTrimBox (const PdfRect &rSize)
unsigned int GetPageNumber () const
virtual PdfObjectGetContents () const
virtual PdfObjectGetContentsForAppending () const
virtual PdfObjectGetResources () const
virtual const PdfRect GetMediaBox () const
virtual const PdfRect GetCropBox () const
virtual const PdfRect GetTrimBox () const
virtual const PdfRect GetBleedBox () const
virtual const PdfRect GetArtBox () const
virtual int GetRotation () const
virtual void SetRotation (int nRotation)
virtual int GetNumAnnots () const
PdfAnnotationCreateAnnotation (EPdfAnnotation eType, const PdfRect &rRect)
PdfAnnotationGetAnnotation (int index)
void DeleteAnnotation (int index)
void DeleteAnnotation (const PdfReference &ref)
int GetNumFields () const
PdfField GetField (int index)
const PdfField GetField (int index) const
PdfObjectGetFromResources (const PdfName &rType, const PdfName &rKey)
const PdfObjectGetInheritedKey (const PdfName &rName) const
virtual void SetICCProfile (const char *pszCSTag, PdfInputStream *pStream, pdf_int64 nColorComponents, EPdfColorSpace eAlternateColorSpace=ePdfColorSpace_DeviceRGB)
Public Member Functions inherited from PoDoFo::PdfElement
PdfObjectGetObject ()
const PdfObjectGetObject () const
Public Member Functions inherited from PoDoFo::PdfCanvas
virtual ~PdfCanvas ()
void AddColorResource (const PdfColor &rColor)
void AddResource (const PdfName &rIdentifier, const PdfReference &rRef, const PdfName &rName)

Static Public Member Functions

static PdfRect CreateStandardPageSize (const EPdfPageSize ePageSize, bool bLandscape=false)
Static Public Member Functions inherited from PoDoFo::PdfCanvas
static const PdfArray GetProcSet ()

Additional Inherited Members

Protected Member Functions inherited from PoDoFo::PdfElement
 PdfElement (const char *pszType, PdfVecObjects *pParent)
 PdfElement (const char *pszType, PdfDocument *pParent)
 PdfElement (const char *pszType, PdfObject *pObject)
 PdfElement (EPdfDataType eExpectedDataType, PdfObject *pObject)
const char * TypeNameForIndex (int i, const char **ppTypes, long lLen) const
int TypeNameToIndex (const char *pszType, const char **ppTypes, long lLen, int nUnknownValue) const
PdfObjectCreateObject (const char *pszType=NULL)
PdfObjectGetNonConstObject () const

Detailed Description

PdfPage is one page in the pdf document. It is possible to draw on a page using a PdfPainter object. Every document needs at least one page.

Constructor & Destructor Documentation

◆ PdfPage() [1/3]

PoDoFo::PdfPage::PdfPage ( const PdfRect & rSize,
PdfDocument * pParent )

Create a new PdfPage object.

Parameters
rSizea PdfRect specifying the size of the page (i.e the /MediaBox key) in PDF units
pParentadd the page to this parent

◆ PdfPage() [2/3]

PoDoFo::PdfPage::PdfPage ( const PdfRect & rSize,
PdfVecObjects * pParent )

Create a new PdfPage object.

Parameters
rSizea PdfRect specifying the size of the page (i.e the /MediaBox key) in PDF units
pParentadd the page to this parent

◆ PdfPage() [3/3]

PoDoFo::PdfPage::PdfPage ( PdfObject * pObject,
const std::deque< PdfObject * > & listOfParents )

Create a PdfPage based on an existing PdfObject

Parameters
pObjectan existing PdfObject
listOfParentsa list of PdfObjects that are parents of this page and can be queried for inherited attributes. The last object in the list is the most direct parent of this page.

Member Function Documentation

◆ CreateAnnotation()

PdfAnnotation * PoDoFo::PdfPage::CreateAnnotation ( EPdfAnnotation eType,
const PdfRect & rRect )

Create a new annotation to this page.

Parameters
eTypethe type of the annotation
rRectrectangle of the annotation on the page
Returns
the annotation object which is owned by the PdfPage

◆ CreateStandardPageSize()

PdfRect PoDoFo::PdfPage::CreateStandardPageSize ( const EPdfPageSize ePageSize,
bool bLandscape = false )
static

Creates a PdfRect with the page size as values which is needed to create a PdfPage object from an enum which are defined for a few standard page sizes.

Parameters
ePageSizethe page size you want
bLandscapecreate a landscape pagesize instead of portrait (by exchanging width and height)
Returns
a PdfRect object which can be passed to the PdfPage constructor

◆ DeleteAnnotation() [1/2]

void PoDoFo::PdfPage::DeleteAnnotation ( const PdfReference & ref)

Delete the annotation object with reference ref from this page.

Parameters
refthe reference of an annotation object of this page.
See also
GetNumAnnots

◆ DeleteAnnotation() [2/2]

void PoDoFo::PdfPage::DeleteAnnotation ( int index)

Delete the annotation with index index from this page.

Parameters
indexthe index of the annotation to delete
See also
GetNumAnnots

◆ GetAnnotation()

PdfAnnotation * PoDoFo::PdfPage::GetAnnotation ( int index)

Get the annotation with index index of the current page.

Parameters
indexthe index of the annotation to retrieve
Returns
a annotation object. The annotation object is owned by the PdfPage.
See also
GetNumAnnots

◆ GetArtBox()

virtual const PdfRect PoDoFo::PdfPage::GetArtBox ( ) const
inlinevirtual

Get the current ArtBox in PDF units.

Returns
PdfRect the page box

◆ GetBleedBox()

virtual const PdfRect PoDoFo::PdfPage::GetBleedBox ( ) const
inlinevirtual

Get the current BleedBox (extra area for printing purposes) in PDF units.

Returns
PdfRect the page box

◆ GetContents()

PdfObject * PoDoFo::PdfPage::GetContents ( ) const
virtual

Get access to the contents object of this page. If you want to draw onto the page, you have to add drawing commands to the stream of the Contents object.

Returns
a contents object

Implements PoDoFo::PdfCanvas.

◆ GetContentsForAppending()

PdfObject * PoDoFo::PdfPage::GetContentsForAppending ( ) const
virtual

Get access an object that you can use to ADD drawing to. If you want to draw onto the page, you have to add drawing commands to the stream of the Contents object.

Returns
a contents object

Implements PoDoFo::PdfCanvas.

◆ GetCropBox()

virtual const PdfRect PoDoFo::PdfPage::GetCropBox ( ) const
inlinevirtual

Get the current CropBox (visible page size) in PDF units.

Returns
PdfRect the page box

◆ GetField() [1/2]

PdfField PoDoFo::PdfPage::GetField ( int index)

Get a PdfField with a certain index.

Parameters
indexof the PdfField (must be smaller than GetNumFields() )
See also
GetNumFields
Returns
a PdfField

◆ GetField() [2/2]

const PdfField PoDoFo::PdfPage::GetField ( int index) const

Get a PdfField with a certain index.

Parameters
indexof the PdfField (must be smaller than GetNumFields() )
See also
GetNumFields
Returns
a constP dfField

◆ GetFromResources()

PdfObject * PoDoFo::PdfPage::GetFromResources ( const PdfName & rType,
const PdfName & rKey )

Get an element from the pages resources dictionary, using a type (category) and a key.

Parameters
rTypethe type of resource to fetch (e.g. /Font, or /XObject)
rKeythe key of the resource
Returns
the object of the resource or NULL if it was not found

◆ GetInheritedKey()

const PdfObject * PoDoFo::PdfPage::GetInheritedKey ( const PdfName & rName) const
inline

Method for getting a value that can be inherited Possible names that can be inherited according to the PDF specification are: Resources, MediaBox, CropBox and Rotate

Returns
PdfObject - the result of the key fetching or NULL

◆ GetMediaBox()

virtual const PdfRect PoDoFo::PdfPage::GetMediaBox ( ) const
inlinevirtual

Get the current MediaBox (physical page size) in PDF units.

Returns
PdfRect the page box

◆ GetNumAnnots()

int PoDoFo::PdfPage::GetNumAnnots ( ) const
virtual

Get the number of annotations associated with this page \ returns int number of annotations

◆ GetNumFields()

int PoDoFo::PdfPage::GetNumFields ( ) const
Returns
the number of PdfFields on this page.

◆ GetPageNumber()

unsigned int PoDoFo::PdfPage::GetPageNumber ( ) const

Page number inside of the document. The first page has the number 1, the last page has the number PdfPagesTree:GetTotalNumberOfPages()

Returns
the number of the page inside of the document
See also
PdfPagesTree:GetTotalNumberOfPages()

◆ GetPageSize()

const PdfRect PoDoFo::PdfPage::GetPageSize ( ) const
inlinevirtual

Get the current page size in PDF Units

Returns
a PdfRect containing the page size available for drawing

Implements PoDoFo::PdfCanvas.

◆ GetResources()

PdfObject * PoDoFo::PdfPage::GetResources ( ) const
inlinevirtual

Get access to the resources object of this page. This is most likely an internal object.

Returns
a resources object

Implements PoDoFo::PdfCanvas.

◆ GetRotation()

int PoDoFo::PdfPage::GetRotation ( ) const
virtual

Get the current page rotation (if any).

Returns
int 0, 90, 180 or 270

◆ GetTrimBox()

virtual const PdfRect PoDoFo::PdfPage::GetTrimBox ( ) const
inlinevirtual

Get the current TrimBox (cut area) in PDF units.

Returns
PdfRect the page box

◆ SetICCProfile()

void PoDoFo::PdfPage::SetICCProfile ( const char * pszCSTag,
PdfInputStream * pStream,
pdf_int64 nColorComponents,
EPdfColorSpace eAlternateColorSpace = ePdfColorSpace_DeviceRGB )
virtual

Set an ICC profile for this page

Parameters
pszCSTaga ColorSpace tag
pStreaman input stream from which the ICC profiles data can be read
nColorComponentsthe number of colorcomponents of the ICC profile (expected is 1, 3 or 4 components)
eAlternateColorSpacean alternate colorspace to use if the ICC profile cannot be used
See also
PdfPainter::SetDependICCProfileColor()

◆ SetPageHeight()

bool PoDoFo::PdfPage::SetPageHeight ( int newHeight)

Set the current page height in PDF Units

Returns
true if successfull, false otherwise

◆ SetPageWidth()

bool PoDoFo::PdfPage::SetPageWidth ( int newWidth)

Set the current page width in PDF Units

Returns
true if successfull, false otherwise

◆ SetRotation()

void PoDoFo::PdfPage::SetRotation ( int nRotation)
virtual

Set the current page rotation.

Parameters
iRotationRotation to set to the page. Valid value are 0, 90, 180, 270.

◆ SetTrimBox()

void PoDoFo::PdfPage::SetTrimBox ( const PdfRect & rSize)

Set the trimbox in PDF Units

Parameters
rSizea PdfRect specifying the trimbox of the page (i.e the /TrimBox key) in PDF units