setasign\SetaPDF2\Core\Document\Catalog
Pages Class for handling PDF pages
File: /SetaPDF v2/Core/Document/Catalog/Pages.php
Old class name (alias):
\SetaPDF_Core_Document_Catalog_Pages
Class hierarchy
Implements
Summary
Methods
- __construct()
- _ensureAllPageObjects()
- _ensureIndirectObjectAndDictionaryAndType()
- _ensurePageObject()
- _ensurePagesArray()
- _readPage()
- _readPageBackwards()
- append()
- cleanUp()
- count()
- create()
- deletePage()
- ensureAllPageObjects()
- extract()
- getDocument()
- getLastPage()
- getPage()
- getPageByAnnotation()
- getPageByIndirectObject()
- getPageNumberByIndirectObject()
- getPageNumberByPageObject()
- getPagesIndirectObject()
- prepend()
- resolvePagesRootObject()
Properties
$_catalog
The catalog instance
Methods
__construct()
_ensureIndirectObjectAndDictionaryAndType()
This method checks an entry in a Kids array for valid values and repairs it (if possible).
Parameters
- $kids : \SetaPDF_Core_Type_Array
- $offset : int
Exceptions
_ensurePageObject()
Ensures that a page object is read and available in the $_pageObjects property.
Parameters
- $pageNumber : int
Exceptions
Throws \InvalidArgumentException
_ensurePagesArray()
Ensures that the parameter ends in an array of \setasign\SetaPDF2\Core\Document\Page instances.
Parameters
- $pages : \SetaPDF_Core_Document_Page|\SetaPDF_Core_Document_Catalog_Pages|array
Exceptions
Throws \setasign\SetaPDF2\Core\Exception
_readPage()
Resolves a page object by walking forwards through the page tree.
This method is optimized, to take the fastest way through the page tree, beginning at the pages root node. The page tree will be walked forward.
Parameters
- $pageNumber : int
The original page number - 1
Exceptions
_readPageBackwards()
Resolves a page object by walking backwards through the page tree.
This method is optimized to take the fastest way through the page tree, beginning at the pages root node. The page tree will be walked forward.
Parameters
- $pageNumber : int
Exceptions
append()
Append pages to the existing pages.
Parameters
- $pages : \SetaPDF_Core_Document_Page|\SetaPDF_Core_Document_Catalog_Pages|array
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \InvalidArgumentException
count()
Returns the page count of the document.
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
See
create()
string $orientation = \setasign\SetaPDF2\Core\PageFormats::ORIENTATION_PORTRAIT,
bool $append = true
Create a page.
Parameters
- $format : string|array
The page format. See constants in \setasign\SetaPDF2\Core\PageFormats and the getFormat() method.
- $orientation : string
The orientation. See constants in \setasign\SetaPDF2\Core\PageFormats.
- $append : bool
Whether the page should be appended to the page tree or not.
Exceptions
deletePage()
Deletes a page.
Parameters
- $pageNumber : int
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
ensureAllPageObjects()
This method makes sure that all pages are read.
It walks the complete page tree to cache/get all page objects in one iteration. This method should be used if all pages of a document should be handled. It is much faster than using the random access.
Exceptions
Throws \BadMethodCallException
extract()
Extracts a page and prepares it for the usage in another document.
This method is needed if a page should be extracted independently. For example the original document should be modified after extraction and the page itself will be edited in the new document (inherited attributes get flattened).
Parameters
- $pageNumber : int
- $document : \SetaPDF_Core_Document
- $returnPageInstance : bool
Exceptions
getLastPage()
getPage()
getPageByAnnotation()
Find the page of an annotation object.
Parameters
- $annotationOrIndirectObject : \SetaPDF_Core_Document_Page_Annotation|\SetaPDF_Core_Type_IndirectObjectInterface
Exceptions
getPageByIndirectObject()
Get a page by its indirect object.
Parameters
- $indirectObject : \SetaPDF_Core_Type_IndirectObjectInterface
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Document\ObjectNotDefinedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
getPageNumberByIndirectObject()
Get the page number by a page indirect object.
If the object is not found in the page tree, false is returned.
Parameters
- $indirectObject : \SetaPDF_Core_Type_IndirectObjectInterface
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Document\ObjectNotDefinedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
getPageNumberByPageObject()
Get the page number by a page object.
If the object is not found in the page tree, false is returned.
Parameters
- $page : \SetaPDF_Core_Document_Page
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Document\ObjectNotDefinedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
getPagesIndirectObject()
Get a pages indirect object.
Parameters
- $pageNumber : int
Exceptions
prepend()
Prepend pages to the existing pages.
Parameters
- $pages : \SetaPDF_Core_Document_Catalog_Pages|\SetaPDF_Core_Document_Page[]|\SetaPDF_Core_Document_Page
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \InvalidArgumentException
resolvePagesRootObject()
Resolves the root page tree node.
Parameters
- $create : bool