pdfmm 0.9.20
Public Member Functions | List of all members
mm::PdfPageTree Class Referencefinal

#include <PdfPageTree.h>

Inherits mm::PdfDictionaryElement.

Public Member Functions

 PdfPageTree (PdfDocument &doc)
 
 PdfPageTree (PdfObject &pagesRoot)
 
virtual ~PdfPageTree ()
 
unsigned GetPageCount () const
 
PdfPageGetPage (unsigned index)
 
PdfPageGetPage (const PdfReference &ref)
 
PdfPageCreatePage (const PdfRect &size)
 
void CreatePages (const std::vector< PdfRect > &sizes)
 
PdfPageInsertPage (unsigned atIndex, const PdfRect &size)
 
void DeletePage (unsigned atIndex)
 

Detailed Description

Class for managing the tree of Pages in a PDF document Don't use this class directly. Use PdfDocument instead.

See also
PdfDocument

Constructor & Destructor Documentation

◆ PdfPageTree() [1/2]

PdfPageTree::PdfPageTree ( PdfDocument doc)

Construct a new PdfPageTree

◆ PdfPageTree() [2/2]

PdfPageTree::PdfPageTree ( PdfObject pagesRoot)

Construct a PdfPageTree from the root /Pages object

Parameters
pagesRootpointer to page tree dictionary

◆ ~PdfPageTree()

PdfPageTree::~PdfPageTree ( )
virtual

Close/down destruct a PdfPageTree

Member Function Documentation

◆ CreatePage()

PdfPage * PdfPageTree::CreatePage ( const PdfRect size)

Creates a new page object and inserts it into the internal page tree. The returned page is owned by the pages tree and will get deleted along with it!

Parameters
sizea PdfRect specifying the size of the page (i.e the /MediaBox key) in PDF units
Returns
a pointer to a PdfPage object

◆ CreatePages()

void PdfPageTree::CreatePages ( const std::vector< PdfRect > &  sizes)

Creates several new page objects and inserts them into the internal page tree. The new pages are owned by the pages tree and will get deleted along with it! Note: this function will attach all new pages onto the same page node which can cause the tree to be unbalanced if

Parameters
sizesa vector of PdfRect specifying the size of each of the pages to create (i.e the /MediaBox key) in PDF units

◆ DeletePage()

void PdfPageTree::DeletePage ( unsigned  atIndex)

Delete the specified page object from the internal pages tree. It does NOT remove any PdfObjects from memory - just the reference from the tree

Parameters
atIndexthe page number (0-based) to be removed

The PdfPage object refering to this page will be deleted by this call! Empty page nodes will also be deleted.

See also
PdfMemDocument::DeletePages

◆ GetPage() [1/2]

PdfPage & PdfPageTree::GetPage ( const PdfReference ref)

Return a PdfPage for the specified Page reference. The returned page is owned by the pages tree and deleted along with it.

Parameters
refthe reference of the pages object
Returns
a pointer to the requested page

◆ GetPage() [2/2]

PdfPage & PdfPageTree::GetPage ( unsigned  index)

Return a PdfPage for the specified Page index The returned page is owned by the pages tree and deleted along with it.

Parameters
indexpage index, 0-based
Returns
a pointer to the requested page

◆ GetPageCount()

unsigned PdfPageTree::GetPageCount ( ) const

Return the number of pages in the entire tree

Returns
number of pages

◆ InsertPage()

PdfPage * PdfPageTree::InsertPage ( unsigned  atIndex,
const PdfRect size 
)

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!

Parameters
sizea PdfRect specifying the size of the page (i.e the /MediaBox key) in PDF units
atIndexindex where to insert the new page (0-based)
Returns
a pointer to a PdfPage object