pdfrx_web
    Preparing search index...

    Class PdfrxEngine

    Entry point to the rendering engine.

    Construct one — in a browser, with the URL of the directory serving the bundled WASM assets; on Node, Bun or Deno, with nothing at all, since the assets ship inside this package — then open documents with openUrl, openData or createNew. A single engine owns one worker shared by all documents it opens; call dispose to tear it down.

    const engine = new PdfrxEngine({ wasmModulesUrl: '/assets/pdfrx/' });
    const doc = await engine.openUrl('https://example.com/doc.pdf');
    const image = await doc.pages[0].render({ fullWidth: 1000, fullHeight: 1414 });
    if (image) {
    canvas.getContext('2d')!.putImageData(image.toImageData(), 0, 0);
    }
    const text = await doc.pages[0].loadText();
    console.log(text?.fullText);
    await doc.dispose();
    engine.dispose();
    Index
    • Registers font data used to substitute missing fonts, then re-render affected pages.

      Parameters

      • face: string

        The face value (string).

      • data: Uint8Array

        The input data.

      • OptionalresolvedFace: string

        The resolvedFace value (string).

      Returns Promise<void>

      The resulting Promise.

    • Spawns the worker and initializes the engine. Called implicitly by the open functions.

      Returns Promise<void>

      The resulting Promise.

    • Opens a document from in-memory PDF bytes.

      Ownership of a full ArrayBuffer (or a full Uint8Array view) is transferred to the worker, detaching it from the caller. Partial views are first copied into a tightly sized buffer and that copy is transferred. Password retries reuse the worker-owned bytes and transfer only the new password.

      Parameters

      • data: ArrayBuffer | Uint8Array<ArrayBufferLike>

        The input data.

      • options: PdfOpenDataOptions = {}

        Options that customize the operation.

      Returns Promise<PdfDocument>

      The resolved Promise.

    • Re-applies registered font data across the worker (e.g. after adding fonts).

      Returns Promise<void>

      The resulting Promise.