PoDoFo  1.0.0-dev
Public Member Functions | Static Public Member Functions | Friends | List of all members
PoDoFo::PdfPage Class Referencefinal

PdfPage is one page in the pdf document. More...

#include <PdfPage.h>

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

Public Member Functions

void ExtractTextTo (std::vector< PdfTextEntry > &entries, const PdfTextExtractParams &params) const
 
void ExtractTextTo (std::vector< PdfTextEntry > &entries, const std::string_view &pattern={ }, const PdfTextExtractParams &params={ }) const
 
Rect GetRect () const
 
Rect GetRectRaw () const override
 Get the current canvas size in PDF Units. More...
 
void SetRect (const Rect &rect)
 
void SetRectRaw (const Rect &rect)
 
bool HasRotation (double &teta) const override
 Get the current canvas rotation. More...
 
void SetMediaBox (const Rect &rect, bool raw=false)
 Set the /MediaBox in PDF Units. More...
 
void SetCropBox (const Rect &rect, bool raw=false)
 Set the /CropBox in PDF Units. More...
 
void SetTrimBox (const Rect &rect, bool raw=false)
 Set the /TrimBox in PDF Units. More...
 
void SetBleedBox (const Rect &rect, bool raw=false)
 Set the /BleedBox in PDF Units. More...
 
void SetArtBox (const Rect &rect, bool raw=false)
 Set the /ArtBox in PDF Units. More...
 
unsigned GetPageNumber () const
 Page number inside of the document. More...
 
Rect GetMediaBox (bool raw=false) const
 Get the current MediaBox (physical page size) in PDF units. More...
 
Rect GetCropBox (bool raw=false) const
 Get the current CropBox (visible page size) in PDF units. More...
 
Rect GetTrimBox (bool raw=false) const
 Get the current TrimBox (cut area) in PDF units. More...
 
Rect GetBleedBox (bool raw=false) const
 Get the current BleedBox (extra area for printing purposes) in PDF units. More...
 
Rect GetArtBox (bool raw=false) const
 Get the current ArtBox in PDF units. More...
 
unsigned GetRotation () const
 Get the normalized page rotation (0, 90, 180 or 270) More...
 
double GetRotationRaw () const
 Get the raw page rotation (if any) More...
 
void SetRotation (int rotation)
 Set the current page rotation. More...
 
bool MoveTo (unsigned index)
 Move the page to the given index.
 
template<typename TField >
TField & CreateField (const std::string_view &name, const Rect &rect, bool rawRect=false)
 
PdfField & CreateField (const std::string_view &name, PdfFieldType fieldType, const Rect &rect, bool rawRect=false)
 
PdfPageFieldIterable GetFieldsIterator ()
 Get an iterator for all fields in the page. More...
 
PdfPageConstFieldIterable GetFieldsIterator () const
 
unsigned GetIndex () const
 
PdfContentsGetOrCreateContents ()
 
PdfResourcesGetOrCreateResources () override
 Get or create the resource object of this page. More...
 
const PdfContentsGetContents () const
 
PdfContentsGetContents ()
 
const PdfContentsMustGetContents () const
 
PdfContentsMustGetContents ()
 
const PdfResourcesGetResources () const
 
PdfResourcesGetResources ()
 
const PdfResourcesMustGetResources () const
 
PdfResourcesMustGetResources ()
 
PdfAnnotationCollection & GetAnnotations ()
 
const PdfAnnotationCollection & GetAnnotations () const
 
- Public Member Functions inherited from PoDoFo::PdfCanvas
virtual ~PdfCanvas ()
 Virtual destructor to avoid compiler warnings.
 
const PdfObjectGetContentsObject () const
 Get access to the contents object of this page. More...
 
PdfObjectGetContentsObject ()
 
charbuff GetContentsCopy () const
 
void CopyContentsTo (charbuff &buffer) const
 
PdfObjectGetFromResources (PdfResourceType type, const std::string_view &key)
 Get an element from the pages resources dictionary, using a type (category) and a key. More...
 
const PdfObjectGetFromResources (PdfResourceType type, const std::string_view &key) const
 
PdfResourcesGetResources ()
 Get the resource object of this page. More...
 
const PdfResourcesGetResources () const
 
PdfDictionaryElement & GetElement ()
 
const PdfDictionaryElement & GetElement () const
 

Static Public Member Functions

static Rect CreateStandardPageSize (const PdfPageSize pageSize, bool landscape=false)
 Creates a Rect 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. More...
 

Friends

class PdfPageCollection
 
class PdfDocument
 

Additional Inherited Members

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.

Member Function Documentation

◆ CreateStandardPageSize()

Rect PdfPage::CreateStandardPageSize ( const PdfPageSize  pageSize,
bool  landscape = false 
)
static

Creates a Rect 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
pageSizethe page size you want
landscapecreate a landscape pagesize instead of portrait (by exchanging width and height)
Returns
a Rect object which can be passed to the PdfPage constructor

◆ GetArtBox()

Rect PdfPage::GetArtBox ( bool  raw = false) const

Get the current ArtBox in PDF units.

Returns
Rect the page box

◆ GetBleedBox()

Rect PdfPage::GetBleedBox ( bool  raw = false) const

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

Returns
Rect the page box

◆ GetCropBox()

Rect PdfPage::GetCropBox ( bool  raw = false) const

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

Returns
Rect the page box

◆ GetFieldsIterator()

PdfPageFieldIterable PdfPage::GetFieldsIterator ( )

Get an iterator for all fields in the page.

All widget annotation fields in the pages will be returned

◆ GetMediaBox()

Rect PdfPage::GetMediaBox ( bool  raw = false) const

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

Returns
Rect the page box

◆ GetOrCreateResources()

PdfResources & PdfPage::GetOrCreateResources ( )
overridevirtual

Get or create the resource object of this page.

Returns
a resources object

Implements PoDoFo::PdfCanvas.

◆ GetPageNumber()

unsigned PdfPage::GetPageNumber ( ) const

Page number inside of the document.

The first page has the number 1

Returns
the number of the page inside of the document

◆ GetRectRaw()

Rect PdfPage::GetRectRaw ( ) const
overridevirtual

Get the current canvas size in PDF Units.

Returns
a Rect containing the page size available for drawing

Implements PoDoFo::PdfCanvas.

◆ GetRotation()

unsigned PdfPage::GetRotation ( ) const

Get the normalized page rotation (0, 90, 180 or 270)

Remarks
It's a clockwise rotation

◆ GetRotationRaw()

double PdfPage::GetRotationRaw ( ) const

Get the raw page rotation (if any)

Remarks
It's a clockwise rotation. It may return an invalid real number number

◆ GetTrimBox()

Rect PdfPage::GetTrimBox ( bool  raw = false) const

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

Returns
Rect the page box

◆ HasRotation()

bool PdfPage::HasRotation ( double &  teta) const
overridevirtual

Get the current canvas rotation.

Parameters
tetacounterclockwise rotation in radians
Returns
true if the canvas has a rotation

Implements PoDoFo::PdfCanvas.

◆ SetArtBox()

void PdfPage::SetArtBox ( const Rect rect,
bool  raw = false 
)

Set the /ArtBox in PDF Units.

Parameters
recta Rect in PDF units

◆ SetBleedBox()

void PdfPage::SetBleedBox ( const Rect rect,
bool  raw = false 
)

Set the /BleedBox in PDF Units.

Parameters
recta Rect in PDF units

◆ SetCropBox()

void PdfPage::SetCropBox ( const Rect rect,
bool  raw = false 
)

Set the /CropBox in PDF Units.

Parameters
recta Rect in PDF units

◆ SetMediaBox()

void PdfPage::SetMediaBox ( const Rect rect,
bool  raw = false 
)

Set the /MediaBox in PDF Units.

Parameters
recta Rect in PDF units

◆ SetRotation()

void PdfPage::SetRotation ( int  rotation)

Set the current page rotation.

Parameters
rotationThe rotation to set to the page. Must be a multiple of 90
Remarks
The actual stored rotation will be normalzed to 0, 90, 180 or 270

◆ SetTrimBox()

void PdfPage::SetTrimBox ( const Rect rect,
bool  raw = false 
)

Set the /TrimBox in PDF Units.

Parameters
recta Rect in PDF units

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