#include <PdfPageCollection.h>
Class for managing the tree of Pages in a PDF document Don't use this class directly. Use PdfDocument instead.
- See also
- PdfDocument
◆ PdfPageCollection() [1/2]
PdfPageCollection::PdfPageCollection |
( |
PdfDocument & | doc | ) |
|
Construct a new PdfPageTree
◆ PdfPageCollection() [2/2]
PdfPageCollection::PdfPageCollection |
( |
PdfObject & | pagesRoot | ) |
|
Construct a PdfPageTree from the root /Pages object
- Parameters
-
pagesRoot | pointer to page tree dictionary |
◆ ~PdfPageCollection()
PdfPageCollection::~PdfPageCollection |
( |
| ) |
|
|
virtual |
Close/down destruct a PdfPageTree
◆ AppendDocumentPages() [1/2]
void PdfPageCollection::AppendDocumentPages |
( |
const PdfDocument & | doc | ) |
|
Appends another PdfDocument to this document.
- Parameters
-
doc | the document to append |
◆ AppendDocumentPages() [2/2]
void PdfPageCollection::AppendDocumentPages |
( |
const PdfDocument & | doc, |
|
|
unsigned | pageIndex, |
|
|
unsigned | pageCount ) |
Copies one or more pages from another PdfMemDocument to this document
- Parameters
-
doc | the document to append |
atIndex | the first page number to copy (0-based) |
pageCount | the number of pages to copy |
◆ CreatePage()
PdfPage & PdfPageCollection::CreatePage |
( |
const Rect & | 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
-
size | a Rect specifying the size of the page (i.e the /MediaBox key) in PDF units |
- Returns
- a pointer to a PdfPage object
◆ CreatePageAt()
PdfPage & PdfPageCollection::CreatePageAt |
( |
unsigned | atIndex, |
|
|
const Rect & | 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
-
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) |
- Returns
- a pointer to a PdfPage object
◆ CreatePagesAt()
void PdfPageCollection::CreatePagesAt |
( |
unsigned | atIndex, |
|
|
unsigned | count, |
|
|
const Rect & | size ) |
Create count new page objects and insert at the index atIndex. This is significantly faster than calling CreatePageAt repeatedly.
- Parameters
-
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) |
◆ FlattenStructure()
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"
◆ GetCount()
unsigned PdfPageCollection::GetCount |
( |
| ) |
const |
Return the number of pages in document
- Returns
- number of pages
◆ GetPage()
Return a PdfPage for the specified Page reference. The returned page is owned by the pages tree and deleted along with it.
- Parameters
-
ref | the reference of the pages object |
- Returns
- a pointer to the requested page
◆ GetPageAt()
PdfPage & PdfPageCollection::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.
- Parameters
-
- Returns
- a pointer to the requested page
◆ InsertDocumentPageAt()
void PdfPageCollection::InsertDocumentPageAt |
( |
unsigned | atIndex, |
|
|
const PdfDocument & | doc, |
|
|
unsigned | pageIndex ) |
Inserts existing page from another PdfDocument to this document.
- Parameters
-
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 |
◆ RemovePageAt()
void PdfPageCollection::RemovePageAt |
( |
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
-
atIndex | the 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