Skip to content
Lamina PDF
Unreleased

These docs describe changes that aren’t released yet. For the newest release, see the released docs.

PageRef

A page of a Document, held by its ID: moving pages doesn’t retarget it (ADR 0028 F2). Freed with its document; every call after that throws disposed.

  • Handle<BaseGlue>

get id(): string

The page’s stable ID (p12.0).

string


get index(): number

The page’s current 0-based index.

LaminaPdfError unknown-page when it is gone.

number


get info(): PageInfoJs

The page’s facts now.

LaminaPdfError unknown-page when it is gone.

PageInfoJs

[dispose](): void

Frees the handle at the end of a using block (an alias of free()).

void

Handle.[dispose]


free(): void

Frees the handle’s memory now; without it, the garbage collector frees it later. A second call does nothing, and any other call afterwards throws disposed. Prefer using, which calls this at the end of the block.

void

Handle.free


text(options?): PageText

The page’s text: lines in reading order, runs, and every glyph’s quad in page space. Needs a document opened while the extract or text module was loaded.

PageTextOptions

skipInvisible leaves out invisible text (OCR layers).

PageText

await init({ extract: true });
const doc = Document.open(bytes);
const text = doc.page(0).text().text();

LaminaPdfError extract-module-not-loaded for a document opened in the base module; unknown-page; reading errors (data-pending for a range document: use ensure).