Skip to content
Lamina PDF
Unreleased

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

Install

Lamina PDF is published to npm as @laminapdf/sdk and to crates.io as laminapdf. Both are alpha releases, so name the version when you install them. A plain npm install or cargo add picks a 0.0.0 placeholder that only reserves the name.

Install the version these docs describe:

Terminal window
npm install @laminapdf/sdk@0.2.0-alpha.2

npm install @laminapdf/sdk@alpha installs the newest alpha, whichever version that is. pnpm, Yarn and Bun take the same name (pnpm add @laminapdf/sdk@0.2.0-alpha.2), and Deno takes npm:@laminapdf/sdk@0.2.0-alpha.2. The package brings @laminapdf/wasm, its WebAssembly modules, as a dependency.

The package is ESM only. It has one entry per runtime (the workerd, deno, browser, node and default export conditions), and each entry loads the .wasm its own way. The quick starts show each one.

Add the crate at the version these docs describe:

Terminal window
cargo add laminapdf@=0.2.0-alpha.2

The command writes laminapdf = "=0.2.0-alpha.2" to Cargo.toml, which keeps your project on this release until you change it: alphas promise nothing to each other (see the stability policy). The default features are text (fonts and text, which includes the builder and text extraction) and saslprep (passwords for AES-256 files). For reading and editing only, add --no-default-features.

Most projects need only the two above. The table links every published package to its registry page:

Package Registry What it holds
@laminapdf/sdk npm The TypeScript API, for every JavaScript runtime
@laminapdf/wasm npm The WebAssembly modules under @laminapdf/sdk
@laminapdf/render npm The interface that page renderers implement
@laminapdf/render-pdfium npm The default web renderer, built on PDFium
@laminapdf/render-hayro npm A second web renderer, built on hayro
@laminapdf/viewer npm The core of a web PDF viewer, one worker per document
laminapdf crates.io The Rust API: open, read, edit, save and build PDFs
laminapdf-syntax crates.io Objects, the lexer, the parser and stream filters
laminapdf-cos crates.io File structure: the tolerant reader and the writer
laminapdf-model crates.io Typed views of pages, outlines, metadata and labels
laminapdf-ops crates.io Editing ops, transactions, undo and redo
laminapdf-save crates.io Incremental and full saves
laminapdf-content crates.io The content-stream interpreter
laminapdf-text crates.io Fonts, shaping and line breaking
laminapdf-build crates.io The builder that generates PDFs
laminapdf-source crates.io Byte sources filled range by range, for remote files
laminapdf-render crates.io The Rust interface that page renderers implement
laminapdf-render-pdfium crates.io The native PDFium renderer

An unreleased change is only in the repository, so build the packages from a checkout. You need Rust (the toolchain in rust-toolchain.toml installs itself), Node 22 or newer and pnpm:

Terminal window
pnpm install
cargo xtask wasm # builds packages/wasm/dist/ and packages/sdk/dist/, then tests them

Then run pnpm pack in packages/wasm and in packages/sdk, and install both .tgz files in one command: @laminapdf/sdk depends on @laminapdf/wasm at the same version, which the registry may not have yet. In Rust, use a path dependency: laminapdf = { path = "../laminapdf/crates/laminapdf" }.