PoDoFo 1.0.0-dev
|
Class for managing the tree of Pages in a PDF document Don't use this class directly. More...
#include <PdfPageCollection.h>
Inherits PoDoFo::PdfDictionaryElement.
Public Types | |
using | PageList = std::vector< PdfPage * > |
using | iterator = Iterator< PdfPage, PageList::iterator > |
using | const_iterator = Iterator< const PdfPage, PageList::const_iterator > |
Public Member Functions | |
PdfPageCollection (PdfDocument &doc) | |
Construct a new PdfPageTree. | |
PdfPageCollection (PdfObject &pagesRoot) | |
Construct a PdfPageTree from the root /Pages object. | |
virtual | ~PdfPageCollection () |
Close/down destruct a PdfPageTree. | |
unsigned | GetCount () const |
Return the number of pages in document. | |
PdfPage & | GetPageAt (unsigned index) |
Return a PdfPage for the specified Page index The returned page is owned by the pages tree and deleted along with it. | |
const PdfPage & | GetPageAt (unsigned index) const |
PdfPage & | GetPage (const PdfReference &ref) |
Return a PdfPage for the specified Page reference. | |
const PdfPage & | GetPage (const PdfReference &ref) const |
PdfPage & | CreatePage (const nullable< Rect > &size=nullptr) |
Creates a new page object and inserts it into the internal page tree. | |
PdfPage & | CreatePage (PdfPageSize pageSize) |
PdfPage & | CreatePageAt (unsigned atIndex, const nullable< Rect > &size=nullptr) |
Creates a new page object and inserts it at index atIndex. | |
PdfPage & | CreatePageAt (unsigned atIndex, PdfPageSize pageSize) |
void | CreatePagesAt (unsigned atIndex, unsigned count, const nullable< Rect > &size=nullptr) |
Create count new page objects and insert at the index atIndex. | |
void | CreatePagesAt (unsigned atIndex, unsigned count, PdfPageSize pageSize) |
void | AppendDocumentPages (const PdfDocument &doc) |
Appends another PdfDocument to this document. | |
void | AppendDocumentPages (const PdfDocument &doc, unsigned pageIndex, unsigned pageCount) |
Copies one or more pages from another PdfMemDocument to this document. | |
void | InsertDocumentPageAt (unsigned atIndex, const PdfDocument &doc, unsigned pageIndex) |
Inserts existing page from another PdfDocument to this document. | |
void | RemovePageAt (unsigned atIndex) |
Delete the specified page object from the internal pages tree. | |
void | FlattenStructure () |
Flatten the document page structure tree. | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Friends | |
class | PdfDocument |
class | PdfPage |
Class for managing the tree of Pages in a PDF document Don't use this class directly.
Use PdfDocument instead.
PdfPageCollection::PdfPageCollection | ( | PdfObject & | pagesRoot | ) |
Construct a PdfPageTree from the root /Pages object.
pagesRoot | pointer to page tree dictionary |
void PdfPageCollection::AppendDocumentPages | ( | const PdfDocument & | doc | ) |
Appends another PdfDocument to this document.
doc | the document to append |
void PdfPageCollection::AppendDocumentPages | ( | const PdfDocument & | doc, |
unsigned | pageIndex, | ||
unsigned | pageCount | ||
) |
Copies one or more pages from another PdfMemDocument to this document.
doc | the document to append |
atIndex | the first page number to copy (0-based) |
pageCount | the number of pages to copy |
PdfPage & PdfPageCollection::CreatePageAt | ( | unsigned | atIndex, |
const nullable< Rect > & | size = nullptr |
||
) |
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!
size | a Rect specifying the size of the page (i.e the /MediaBox key) in PDF units |
atIndex | index where to insert the new page (0-based) |
void PdfPageCollection::CreatePagesAt | ( | unsigned | atIndex, |
unsigned | count, | ||
const nullable< Rect > & | size = nullptr |
||
) |
Create count new page objects and insert at the index atIndex.
This is significantly faster than calling CreatePageAt repeatedly.
size | a Rect specifying the size of the page (i.e the /MediaBox key) in PDF units |
count | number of pages to create |
atIndex | index where to insert the new page (0-based) |
void PdfPageCollection::FlattenStructure | ( | ) |
Flatten the document page structure tree.
This copy pages inheritable attributes and remove intermediate /Pages nodes. This operation is allowed by the PDF specification, see "ISO 32000-2:2020, 7.7.3.2 Page tree nodes"
unsigned PdfPageCollection::GetCount | ( | ) | const |
Return the number of pages in document.
PdfPage & PdfPageCollection::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.
ref | the reference of the pages object |
Return a PdfPage for the specified Page index The returned page is owned by the pages tree and deleted along with it.
index | page index, 0-based |
void PdfPageCollection::InsertDocumentPageAt | ( | unsigned | atIndex, |
const PdfDocument & | doc, | ||
unsigned | pageIndex | ||
) |
Inserts existing page from another PdfDocument to this document.
atIndex | index at which to add the page in this document |
doc | the document to append from |
pageIndex | index of page to append from doc |
Delete the specified page object from the internal pages tree.
It does NOT remove any PdfObjects from memory - just the reference from the tree
atIndex | the page number (0-based) to be removed |
The PdfPage object referring to this page will be deleted by this call! Empty page nodes will also be deleted.