pdfrx_web
    Preparing search index...

    Class PdfPage

    A page of a document. Obtain instances via PdfDocument.pages; do not construct directly.

    A page has two identities that usually coincide but need not: where it sits in the document (pageNumber, its rotation) and which physical page of which PDF it draws (sourcePage). rotatedTo returns a proxy page that changes the effective rotation while sharing the physical page. PdfDocument.setPages similarly assigns placement and page numbers from array order, which is what makes rearrangement free.

    Index
    basePage: PdfPage | null

    The real page this one stands in for, or null if this is a real page.

    document: PdfDocument

    Document whose current arrangement contains this page.

    For an imported page this differs from sourceDocument, which owns the physical PDF page and its annotations and form widgets.

    height: number

    Page height in points (1/72 inch), at this page's rotation.

    Opaque logical-page identity. Placement and rotation proxies retain it; duplicate creates a distinct identity without copying PDF data.

    isLoaded: boolean

    False for pages not yet materialized during progressive loading.

    pageNumber: number

    1-based page number — the position in PdfDocument.pages, not in the PDF.

    rotation: PdfPageRotation

    Effective page rotation (clockwise); on a rotated proxy this differs from the rotation baked into the PDF.

    sourceDocument: PdfDocument

    The document holding the physical page this one draws.

    width: number

    Page width in points (1/72 inch), at this page's rotation.

    • get sourceKey(): string

      Identity of the physical page, independent of where it sits in the document. Two pages with the same key produce the same text and links.

      Returns string

    • Adds an annotation to this page and returns its id.

      The id is stored in the PDF annotation dictionary's /NM ("annotation name") entry. /NM is a PDF-standard string intended to distinguish an annotation from the other annotations on the same page; it is not the visible annotation text or the page number. The engine generates one when PdfAnnotationSpec.id is omitted. Keep the returned value to pass to updateAnnotation or removeAnnotation, or to correlate the annotation with another representation. It is preserved when the PDF is encoded and opened again.

      The physical write is sent to sourceDocument; the annotationsChanged event is emitted from the source document and every open arrangement that places that source page. Duplicate placements share annotation state and all of their page numbers are reported as affected.

      Parameters

      Returns Promise<string>

      The resulting Promise.

    • Creates an immutable destination for this logical page or its current 1-based position.

      An ID-based destination is ambiguous when the same page identity occurs in multiple arrangement slots. Use duplicate when destinations must distinguish repeated placements; see that method for examples and details.

      Parameters

      Returns PdfDest

      The resulting PdfDest.

    • Returns a lightweight proxy over the same physical page with a new logical identity. No PDF data is copied or materialized, so this operation is effectively free. The returned page still renders the same physical page; only placement identity is separated.

      This matters when one PdfPage is placed more than once. Reusing the same object also reuses its opaque id, so an ID-based dest can identify the page but not a particular occurrence:

      const [page, ...rest] = document.pages;
      document.setPages([page!, ...rest, page!]);

      const ambiguous = page!.dest({
      by: 'id',
      command: 'fit',
      params: [],
      });
      // Both placements have the same ID. Following `ambiguous` selects one
      // matching placement; callers must not rely on which one is selected.

      Call duplicate() before arranging the second occurrence when destinations must distinguish them:

      const [page, ...rest] = document.pages;
      const secondPlacement = page!.duplicate();
      document.setPages([page!, ...rest, secondPlacement]);

      const firstDest = page!.dest({
      by: 'id',
      command: 'fit',
      params: [],
      });
      const secondDest = secondPlacement.dest({
      by: 'id',
      command: 'fit',
      params: [],
      });

      The two destinations now follow separate placements, while both pages continue to use the same underlying PDF page data.

      Returns PdfPage

      The resulting PdfPage.

    • Whether other draws the same physical page of the same PDF, regardless of page number or rotation. Useful for keying caches by content.

      Parameters

      • other: PdfPage

        The other value (PdfPage).

      Returns boolean

      Whether the condition is satisfied.

    • Loads the AcroForm fields whose widgets sit on this page, grouped by fully-qualified name. Rects are in PDF page coordinates (bounding-box relative, like loadLinks). Returns an empty array if the document is disposed, has no form, or the page is not yet loaded.

      Returns Promise<PdfFormField[]>

      The resolved Promise.

    • Loads link annotations on the page and, when enableAutoLinkDetection is true (the default), URL-like text detected in the page content. Pending annotation-CRUD changes are returned instead of physical Link annotations while retaining transient detected URLs.

      Parameters

      • options: { enableAutoLinkDetection?: boolean } = {}

        Options that customize the operation.

      Returns Promise<PdfLink[]>

      The resolved Promise.

    • Loads the full text of the page with one bounding rect per UTF-16 code unit (in page coordinates). Returns null if the document is disposed or the page is not yet loaded (progressive loading).

      Returns Promise<PdfPageRawText | null>

      The resolved Promise.

    • Removes the annotation identified by id; returns whether it was found.

      Parameters

      • id: string

        The PdfAnnotationObject.id returned by loadAnnotations, or the id returned by addAnnotation. This is normally the annotation dictionary's stable /NM ("annotation name") value, a PDF-standard string used to distinguish annotations on the page. For an existing annotation without /NM, loadAnnotations() returns a page-local @<index> fallback instead. Such a fallback is positional, so use it before any other annotation is added, removed, or replaced on this page; otherwise load the annotations again and use the new id.

      • options: PdfAnnotationMutationOptions = {}

        Options that customize the operation.

      Returns Promise<boolean>

      The resulting Promise.

    • Creates a page-placement proxy with the requested absolute rotation.

      Calling this method alone does not modify the PDF or PdfDocument.pages. Pass the returned page to PdfDocument.setPage to replace one placement, or include it in the array passed to PdfDocument.setPages. Those methods update the in-memory arrangement synchronously; PdfDocument.encodePdf or PdfDocument.materialize later writes the arrangement into the physical PDF.

      rotation is clockwise and absolute: 90 means the page is displayed at 90 degrees regardless of the page's current rotation property. If it already has the requested rotation, this method returns this.

      Parameters

      • rotation: PdfPageRotation

        The clockwise page rotation, in 90-degree steps.

      Returns PdfPage

      The resulting PdfPage.

      const page = doc.pages[2]!;
      doc.setPage(3, page.rotatedTo(90));
    • Replaces annotation id with a fresh annotation built from the complete spec, preserving the id. PDFium has no in-place geometry setter.

      Parameters

      • id: string

        The PdfAnnotationObject.id returned by loadAnnotations, or the id returned by addAnnotation. This is normally the annotation dictionary's /NM ("annotation name") value: a PDF-standard string used to distinguish annotations on the page. Existing PDFs whose annotation has no /NM use a page-local @<index> fallback; use that fallback only with the unchanged result from the most recent loadAnnotations() call because page mutations can change the index.

      • spec: PdfAnnotationSpec

        The spec value (PdfAnnotationSpec).

      • options: PdfAnnotationMutationOptions = {}

        Options that customize the operation.

      Returns Promise<string>

      The resulting Promise.