PDF::API2::Basic::PDF::Pages - Low-level page tree object
| Use Case | Command | Description |
|---|---|---|
| Create a new pages object | PDF::API2::Basic::PDF::Pages->new($pdf, $parent) | Create a new Pages object in a PDF (root node if $parent is file context) |
| Find a page by number | $p->find_page($page_number) | Return the page object for the given page number (0‑based) |
| Insert a page at a position | $p->add_page($page, $page_number) | Insert a page before the given page number; negative counts from end |
| Get all pages in order | $p->get_pages() | Return a list of page objects in document order |
| Find an inherited property | $p->find_prop($key) | Search up the inheritance tree for a property |
| Add a font to resources | $p->add_font($pdf, $font) | Add font to the resource dictionary at this level (if not already inherited) |
| Set bounding box | $p->bbox($xmin, $ymin, $xmax, $ymax, [$param]) | Set the bounding box for this and all child pages |
| Ensure proc set entries | $p->proc_set(@entries) | Ensure the current resource contains the listed proc set entries |
| Get top of pages tree | $p->get_top | Return the root of the pages tree |
A Pages object is the parent to other pages objects or to page objects themselves.
PDF::API2::Basic::PDF::Pages->new($pdf, $parent) — This creates a new Pages object in a PDF. Notice that $parent here is not the file context for the object but the parent pages object for this pages. If we are using this class to create a root node, then $parent should point to the file context, which is identified by not having a Type of Pages. $pdf is the file object (or a reference to an array of file objects) in which to create the new Pages object.$p->find_page($page_number) — Returns the given page, using the page count values in the pages tree. Pages start at 0.$p->add_page($page, $page_number) — Inserts the page before the given $page_number. $page_number can be negative to count from the END of the document. -1 is after the last page. Likewise $page_number can be greater than the number of pages currently in the document, to append.$p->get_pages() — Returns a list of page objects in the document in page order.$p->find_prop($key) — Searches up through the inheritance tree to find a property.$p->add_font($pdf, $font) — Creates or edits the resource dictionary at this level in the hierarchy. If the font is already supported even through the hierarchy, then it is not added.$p->bbox($xmin, $ymin, $xmax, $ymax, [$param]) — Specifies the bounding box for this and all child pages. If the values are identical to those inherited then no change is made. $param specifies the attribute name so that other 'bounding box'es can be set with this method.$p->proc_set(@entries) — Ensures that the current resource contains all the entries in the proc_sets listed. If necessary it creates a local resource dictionary to achieve this.$p->get_top — Returns the top of the pages tree.Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 08:07 @216.73.216.194
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format