skia
    Preparing search index...

    Interface PDFDocument

    PDFDocument is a class that captures drawing commands across pages and outputs a PDF.

    interface PDFDocument {
        _type: "PDFDocument";
        beginPage(width: number, height: number): Canvas;
        beginPageWithContentRect(
            width: number,
            height: number,
            contentRect: InputRect,
        ): Canvas;
        close(): Uint8Array;
        delete(): void;
        deleteLater(): void;
        endPage(): void;
        isAliasOf(other: any): boolean;
        isDeleted(): boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _type: "PDFDocument"

    Methods

    • Starts a new page with the given dimensions and returns a canvas to draw on it.

      Parameters

      • width: number
      • height: number

      Returns Canvas

    • Starts a new page with the given dimensions and an explicit content rect. The content rect tells PDF viewers which portion of the page holds actual content (used for cropping, thumbnails, and accessibility metadata).

      Parameters

      • width: number
      • height: number
      • contentRect: InputRect

        [left, top, right, bottom] in page coordinates

      Returns Canvas

    • Finalizes the document and returns the PDF data as a Uint8Array.

      Returns Uint8Array