Pages and Elements

Understand PDF pages, native source content, editable overlays, and coordinate systems.

Document structure

IPdfDocument contains the normalized PDF document model:

  • pages stores the page order, size, rotation, layers, labels, and native PDF boxes.
  • objects stores semantic document objects.
  • displayLists retain render-level PDF operations and preserve fidelity to the source file.
  • textStories keep editable text as a flow, separate from PDF glyph grouping, which is not stable.
  • assets, styles, and native retain reusable resources and resources specific to the source.
  • sources, edits, and exportPlan record where content originated and what the export should do.

During PDF import, not every visible source operation becomes an editable Facade element. Native content remains in the display lists until a user action promotes or replaces it.

Pages

FPdf reads pages in materialized order and can insert blank pages:

TypeScript
const pages = pdf.getPages()const firstPage = pdf.getPageByIndex(0)const pageById = firstPage ? pdf.getPageById(firstPage.getId()) : nullconst appendedPage = pdf.insertPage()

insertPage(index) accepts an integer from 0 through the current page count. A new page inherits the size, rotation, and PDF boxes of its neighbor. If no neighbor exists, the page uses A4, which is 595 by 842 points.

Native content and editable overlays

FPdfPage.getElements() returns durable editable overlays in z-order. The typed accessors below filter the same overlay layer:

AccessorFacade wrapper
getTextBoxes()FPdfTextBox
getParagraphs()FPdfParagraph
getLists()FPdfList
getTables()FPdfTable
getImages()FPdfImage
getDividers()FPdfDivider
getAnnotations()FPdfAnnotation

getTextSpans() behaves differently. It enumerates snapshots of the visible native text operations. Calling replaceText() on a span suppresses the native operation and creates a new editable text box.

Coordinate systems

The core model and the public Facade use different units by design:

BoundaryUnit and origin
Facade positions, sizes, annotation paths, and stroke widthsPDF points, positioned from the top left
Core model page and object geometryEMU, origin at the top left
Imported pdfBoxes and native source mappingsPDF user space, origin at the bottom left

Application code uses getTransform, setPosition, setSize, setRotation, and the typed Facade insert options. The ptToEmu, emuToPt, and related conversion helpers are required only when building lower-level model data.

Public editing limits

The Facade validates several model constraints:

  • Width and height must be positive finite values. Positions and rotations must be finite.
  • List levels range from 0 through 8, and the start number of an ordered list must be a positive integer.
  • A table must have positive integer dimensions and contain no more than 10,000 cells.
  • Facade annotation insertion supports highlight, underline, strikeout, squiggly, and ink annotations.
  • Image opacity ranges from 0 through 1, and a crop rectangle must have a positive area.
  • Text ranges use UTF-16 offsets, with an inclusive start and an exclusive end.

For task-oriented examples, continue with Editing PDFs.

How is this guide?

© 2026 DreamNum Co., Ltd.