Start here, on one page
This page shows every Start here page in order. Read offline lists every section and the whole guide as one PDF.
Lamina PDF
Lamina PDF creates, reads, edits and saves PDFs. One Rust core does the work, and it runs natively and as WebAssembly in browsers, Node, Deno, Bun and Cloudflare Workers. It’s for apps that make documents, such as invoices, reports and tickets, and for apps that open documents other people send.
laminapdfon crates.io is the Rust crate. Its API reference is on docs.rs.@laminapdf/sdkon npm is the TypeScript API over the WebAssembly build. After oneawait init(), every call is synchronous, and the API is the same in every runtime. Its API reference is on this site.
What works today
Section titled “What works today”| Area | What you get | Guide |
|---|---|---|
| Generate | Pages, text with shaping, bidi and line breaking, embedded and subset fonts, the standard 14, vectors, colour, images, tagged PDF | Fonts and text, Images and vectors |
| Navigate | Links, named destinations, outlines, page labels, Info and XMP metadata | Links, outlines and metadata |
| Edit | Ops in transactions, undo and redo, incremental or full saves that respect signatures | Edit a PDF, Save a PDF |
| Extract | Text, Markdown and JSON in reading order, with tables, a box for every block and chunks for retrieval | Extract text and Markdown |
| Read safely | Repair of damaged files as warnings, resource limits, strict mode, passwords | Open password-protected files, Open files you don’t trust |
| Errors | One coded error and warning shape on every surface | Errors and warnings |
Every code block on this site is a tested example file, so the code you see is the code that runs. Each example writes the same bytes in Rust and in every JavaScript runtime.
Where to go next
Section titled “Where to go next”Start with your first PDF in TypeScript, in Rust or on the command line, then read how Lamina PDF thinks about a PDF. When you’re ready for your own setup, pick your runtime. To read away from the site, see Read offline: each section on one page, and the whole guide as one PDF.
Choosing a PDF library for TypeScript or Rust
Which PDF library to use depends on the job: making new PDFs, reading text out of them, showing pages on screen, or changing files someone sent you. Most libraries do one or two of these jobs well. This page lists what the common TypeScript and Rust libraries do, by their own documentation, so you can pick the one that fits.
Every fact about another library links to that library’s own docs, README or registry entry, as checked on 11 November 2026. Libraries change, so follow the link before you rely on a cell. If a fact here is wrong or out of date, open an issue and we’ll correct it.
What the columns mean
Section titled “What the columns mean”Each table has one row per library and one column per job:
- Make: create new PDFs with text, shapes and images.
- Read: open existing PDFs and walk their pages and objects.
- Text: extract the text of a page.
- Render: draw pages as images or onto a canvas.
- Edit: change an existing PDF and save it again.
- Forms: create form fields, or fill in the fields of an existing PDF.
- Sign: add a digital signature, or verify one.
- PDF/A, PDF/UA: write PDF/A, the archival standard whose files look the same in years to come, or PDF/UA, the standard for files screen readers can follow.
A cell says Yes; Partly, with a note on what’s missing; or No, when the library’s docs say it doesn’t do the job or is built for something else. A dash means its docs don’t say either way.
TypeScript and JavaScript
Section titled “TypeScript and JavaScript”| Library | Make | Read | Text | Render | Edit | Forms | Sign | PDF/A, PDF/UA |
|---|---|---|---|---|---|---|---|---|
| pdf-lib | Yes | Yes, not encrypted files | No | — | Partly: pages, not their text | Yes: create and fill | No | — |
| LibPDF | Yes | Yes | Yes | — | Yes | Yes: create and fill | Partly: signs, doesn’t verify | — |
| PDFKit | Yes | No | No | No | No | Partly: create only | — | Yes |
| jsPDF | Yes | No | No | No | No | Partly: create only | — | — |
| pdfmake | Yes | No | No | No | No | — | — | Partly: PDF/A, and PDF/UA as a flag |
| PDF.js | No | Yes | Yes | Yes | Partly: annotations and form values | Partly: fill only | — | No |
| Lamina PDF | Yes | Yes | Yes | Yes, with a renderer package | Partly: document info and page rotation | No | No | Yes |
Licences, versions and runtimes, from each package’s npm entry and README:
| Library | Licence | Latest release | Runtimes its docs name |
|---|---|---|---|
| pdf-lib | MIT | 1.17.1, 6 November 2021 | Node, browsers, Deno, React Native |
| LibPDF | MIT | 0.5.3, 16 October 2026, marked beta | Node 20 or later, Bun, browsers |
| PDFKit | MIT | 0.20.2, 30 August 2026 | Node, browsers |
| jsPDF | MIT | 4.2.1, 17 March 2026 | Browsers, Node |
| pdfmake | MIT | 0.3.14, 8 November 2026 | Node 20 or later, browsers |
| PDF.js | Apache-2.0 | 6.5.438, 1 November 2026 | Browsers; Node 22 or later, “mostly” |
| Lamina PDF | MIT or Apache-2.0 | 0.9.0 | Browsers, Node, Deno, Bun, Cloudflare Workers |
A few details the tables leave out:
- pdf-lib has had no release since November 2021, and it can’t open encrypted files. It reads the values of form fields, but no other text.
- LibPDF describes itself as beta software whose APIs “may change between minor versions”. Its saves can append changes, which keeps existing signatures valid.
- PDFKit, jsPDF and pdfmake make new documents only; pdfmake is built on PDFKit. For PDF/A, PDFKit needs fonts you embed, since its built-in fonts don’t meet the standard.
- PDF.js reads and draws PDFs, mainly in the browser. It fills in forms and adds some annotations, but it doesn’t make new PDFs.
| Crate | Make | Read | Text | Render | Edit | Forms | Sign | PDF/A, PDF/UA |
|---|---|---|---|---|---|---|---|---|
| lopdf | Partly: you build the objects | Yes | Yes | — | Yes | — | — | — |
| printpdf | Yes | Partly: experimental | Partly: experimental | Partly: to SVG, experimental | Partly: re-save after parsing | — | — | No: PDF/X-3 only |
| pdf-writer | Partly: you build the objects | No | — | — | No | Partly: writes new fields | — | Partly: you build the structure |
| krilla | Yes | Partly: embeds pages of other PDFs | — | — | — | — | No | Yes |
| hayro | — | Yes, not encrypted files | — | Yes | No | — | — | — |
| pdfium-render | Yes | Yes | Yes | Yes | Yes | Yes: fill | Partly: reads signatures | — |
| Lamina PDF | Yes | Yes | Yes | Yes, with a renderer crate | Partly: document info and page rotation | No | No | Yes |
Licences, versions and what each crate needs, from crates.io and each README:
| Crate | Licence | Latest release | What it needs |
|---|---|---|---|
| lopdf | MIT | 0.47.0, 4 November 2026 | No C library named in its docs |
| printpdf | MIT | 0.12.8, 5 September 2026 | Reads PDFs through lopdf; runs in WebAssembly |
| pdf-writer | MIT or Apache-2.0 | 0.15.0, 27 May 2026 | Rust only, no unsafe code |
| krilla | MIT or Apache-2.0 | 0.8.2, 4 June 2026 | Built on pdf-writer |
| hayro | MIT or Apache-2.0 | 0.9.0, 2 November 2026 | Pure Rust, renders on the CPU |
| pdfium-render | MIT or Apache-2.0 | 0.9.5, 1 November 2026 | The PDFium C++ library, which you ship |
| Lamina PDF | MIT or Apache-2.0 | 0.9.0 | Pure Rust; PDFium only for the PDFium renderer |
A few details the tables leave out:
- lopdf and pdf-writer work at the level of PDF objects. You write the page dictionaries and drawing operators yourself, so you need to know the PDF format.
- krilla checks PDF/A and PDF/UA rules it can test, and leaves the rest to you: its docs say some requirements “are semantic in nature”.
- hayro is a renderer only: its README calls document changes “out-of-scope”. It also says untrusted files can still cause timeouts and out-of-memory errors.
- pdfium-render gives you most of Google’s PDFium library from Rust. In return you ship a PDFium binary for each platform, and calls run one at a time, since PDFium “makes no guarantees about thread safety”.
Where Lamina PDF fits
Section titled “Where Lamina PDF fits”Lamina PDF is one Rust core that makes, reads, extracts, renders and saves PDFs. It runs natively and as WebAssembly in every runtime the TypeScript table lists. It reads damaged files and reports what it repaired, saves your changes after the original bytes as an incremental save, and writes PDF/A and PDF/UA files that its tests check with veraPDF, the reference checker for PDF/A and PDF/UA. Its tests check that every runtime writes the same bytes for the same input.
It isn’t the right choice for every job today:
- It’s at
0.x. A new minor version can still change its API; the stability policy says what each version promises and what stays fixed. - It doesn’t fill forms or sign. LibPDF and pdfium-render fill form fields today, and LibPDF signs.
- Its editing is narrow. It changes document info, such as the title and author, and page rotation. It can’t yet edit the text or images already on a page.
For every operation, the reader’s capability page shows what Lamina PDF reads, writes and round-trips today in the Rust core, the TypeScript library, the web reader and the desktop app. A status appears there only when a test proves it.
To see how Lamina PDF is checked, read How we test. Benchmarks has its timings and download sizes in each runtime.
Next: Install Lamina PDF, or make your first PDF.
Install
Lamina PDF is published to npm as @laminapdf/sdk and to crates.io as laminapdf. Both follow SemVer from 0.2.0 on: a breaking change raises the minor version (0.2 to 0.3), so an upgrade within one 0.x line, such as 0.2.0 to 0.2.1, needs no change to your code.
TypeScript: @laminapdf/sdk
Section titled “TypeScript: @laminapdf/sdk”Install the version these docs describe:
npm install @laminapdf/sdk@0.9.0Without a version, npm install @laminapdf/sdk installs the newest release. pnpm, Yarn and Bun take the same name (pnpm add @laminapdf/sdk@0.9.0), and Deno takes npm:@laminapdf/sdk@0.9.0. 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.
Rust: laminapdf
Section titled “Rust: laminapdf”Add the crate at the version these docs describe:
cargo add laminapdf@0.9.0The command writes laminapdf = "0.9.0" to Cargo.toml, and Cargo reads it as this release or a later one in the same 0.x line, which the stability policy promises needs no change to your code.
The default features start with text: fonts and text, which includes the builder and text extraction. Four more are on by default: markdown (Markdown in, flowing pages out), document (JSON documents in, flowing pages out), reflow (a tagged document’s text in reading order, for reader mode) and saslprep (passwords for AES-256 files). For reading and editing only, add --no-default-features, then turn on what you need: build for the builder without text, extract for text extraction alone. explain, off by default, gives each code’s page as text. Your first PDF in Rust walks through a first program.
The command-line tool
Section titled “The command-line tool”The laminapdf command does the common jobs from a terminal or a script, without a Node or Rust project: describe, check, extract, render and build PDFs. Homebrew installs it with brew install laudebugs/tap/laminapdf; install the command-line tool has npm and downloads for macOS, Linux and Windows. Your first PDF on the command line walks through a first session.
Every published package
Section titled “Every published package”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 (guide) |
@laminapdf/render-pdfium |
npm | The default web renderer, built on PDFium (guide) |
@laminapdf/render-hayro |
npm | A second web renderer, built on hayro (guide) |
@laminapdf/viewer |
npm | The core of a web PDF viewer, one worker per document (guide) |
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 (guide) |
laminapdf-render-pdfium |
crates.io | The native PDFium renderer (guide) |
In JavaScript, @laminapdf/sdk is the TypeScript API, and it depends on @laminapdf/wasm, whose WebAssembly the SDK loads as three modules: base, extract and text. @laminapdf/viewer, a web PDF viewer, depends on @laminapdf/sdk, on @laminapdf/render, the interface that renderers implement, and on both renderers. Those renderers are @laminapdf/render-pdfium, the default, and @laminapdf/render-hayro, which also uses @laminapdf/wasm. In Rust, the API is one crate, laminapdf, with features instead of modules.
Try a change before it’s released
Section titled “Try a change before it’s released”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:
pnpm installcargo xtask wasm # builds packages/wasm/dist/ and packages/sdk/dist/, then tests themThen 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" }.
API docs
Section titled “API docs”- TypeScript: the
@laminapdf/sdkreference, generated from the package’s TSDoc comments. - Rust: the Rust API page, which links each crate’s docs on docs.rs.
Your first PDF
You’ll write hello.pdf, one A4 page that says “Hello, world!”, from a short Node script. It takes about five minutes.
Make a project
Section titled “Make a project”You need Node 24.2 or newer, which runs .ts files directly. Create a folder and install @laminapdf/sdk from npm:
mkdir hello-pdf && cd hello-pdfnpm init -y && npm pkg set type=modulenpm install @laminapdf/sdk@0.9.0The install names the version these docs describe, so the code below matches the package you get. @laminapdf/sdk brings its WebAssembly modules, @laminapdf/wasm, with it. Install covers other package managers and Rust.
Write the page
Section titled “Write the page”Save this app as hello.ts. It loads Lamina PDF, builds the page and writes it to hello.pdf:
// Builds a one-page PDF that says "Hello, world!" and writes it to hello.pdf, in Node.import { writeFile } from "node:fs/promises";import { Builder, type BuilderOptions, Font, init } from "@laminapdf/sdk";
/** The space between the page's edge and the text, in points (72 points = 1 inch). */const MARGIN = 72;/** The text's size in points; its baseline sits this far below the margin. */const FONT_SIZE = 24;
/** Builds the page and hands its bytes to `save`, which writes hello.pdf unless you pass another `save` function. */export async function hello( save: (pdf: Uint8Array) => void | Promise<void> = (pdf) => writeFile("hello.pdf", pdf), options: BuilderOptions = {},): Promise<void> { await init({ text: true }); using builder = new Builder(options); const page = builder.page("A4"); // Points from the page's top-left corner, y down; the text's baseline sits FONT_SIZE points below the margin. page.surface().text("Hello, world!", { font: Font.standard("Helvetica"), size: FONT_SIZE, at: [MARGIN, MARGIN + FONT_SIZE], }); page.finish(); using doc = builder.finish(); await save(doc.save());}
// `node hello.ts` runs it (Node 24.2 or newer); imported, it only exports `hello`.if (import.meta.main) await hello();
On the docs site, the picture with the code is the page this app makes. To try a change before you set anything up, press Edit and run under the picture: your browser runs the code and shows the page it makes in place of the picture. Your browser can’t write hello.pdf to your disk, so Download PDF saves it instead.
Run it
Section titled “Run it”node hello.tsNode runs the TypeScript file as it is. Open hello.pdf in any PDF viewer: one page, with “Hello, world!” near its top-left corner.
What happened
Section titled “What happened”init({ text: true }) loaded Lamina PDF’s text module, the one that draws fonts; after it, every call is synchronous. The builder made an A4 page, drew the text on it and finished into a document, doc.save() turned that document into bytes, and save wrote them to hello.pdf. using freed the builder and the document as soon as the function ended.
Next, see how Lamina PDF thinks about a PDF and where things go on a page. To use laminapdf somewhere other than Node, pick your runtime.
Your first PDF in Rust
You’ll write hello.pdf, one A4 page that says “Hello, world!”, from a small Rust program. It takes about five minutes, most of it for the first build.
Make a project
Section titled “Make a project”You need Rust 1.97 or newer. Create a project and add the laminapdf crate:
cargo new hello-pdf && cd hello-pdfcargo add laminapdf@0.9.0This adds the version these docs describe. Cargo reads it as this release or a later one in the same 0.x line, which the stability policy promises needs no change to your code. Install covers the crate’s features.
Write the page
Section titled “Write the page”Replace src/main.rs with this program. It builds the page and writes it to hello.pdf:
//! The smallest document: one A4 page with a line of text in a standard 14 font.//!//! ```sh//! cargo run -p laminapdf --example hello -- [out-dir] # writes <out-dir>/hello.pdf (default target/examples-out)//! ```
use std::error::Error;use std::path::PathBuf;
use laminapdf::{BuildOptions, Builder, PageSize, PointPt, Pt, SaveOptions, Standard14};
fn main() -> Result<(), Box<dyn Error>> { let out = PathBuf::from(std::env::args().nth(1).unwrap_or_else(|| "target/examples-out".into())); std::fs::create_dir_all(&out)?; std::fs::write(out.join("hello.pdf"), build(BuildOptions::new())?)?; Ok(())}
/// The document's bytes. `options` can fix the file ID, the producer and the creation date, so/// that the same input gives the same bytes on every run.pub(crate) fn build(options: BuildOptions) -> Result<Vec<u8>, Box<dyn Error>> { let mut b = Builder::new(options); let helvetica = b.standard_font(Standard14::Helvetica)?; let mut page = b.page(PageSize::A4); // Page space: points from the top-left corner, y down; `y` is the text's baseline. page.surface().text( "Hello, world!", &helvetica, Pt::new(24.0), PointPt::from_points(72.0, 96.0), )?; page.finish()?; let mut doc = b.finish()?; Ok(doc.save(&SaveOptions::new())?.bytes)}
Run it
Section titled “Run it”cargo runThe comment at the top of the file shows how Lamina PDF’s own repository runs it; in your project, cargo run is all it takes. The program writes target/examples-out/hello.pdf; cargo run -- out writes out/hello.pdf instead. Open it in any PDF viewer: one page, with “Hello, world!” near its top-left corner.
What happened
Section titled “What happened”Builder made an A4 page, and the page’s surface drew the text in Helvetica, one of the standard 14 fonts every PDF viewer has, so nothing was embedded. Points count from the page’s top-left corner, and the text’s y is its baseline. finish turned the builder into a document, and save turned the document into bytes.
build takes BuildOptions, which can fix the file ID, the producer and the creation date, so the same program writes the same bytes on every run. The examples on this site use that to check their output byte for byte.
Next, see how Lamina PDF thinks about a PDF and where things go on a page. For your own fonts and text that wraps, read text and fonts.
Your first PDF on the command line
You’ll turn a short Markdown file into a tagged PDF with the laminapdf command, then check the PDF, read its text back and draw its page as an image. It takes about five minutes, and you need no Node or Rust project.
Install the tool
Section titled “Install the tool”On macOS and Linux, install it with Homebrew; anywhere npm runs, install it with npm:
brew install laudebugs/tap/laminapdfnpm install -g @laminapdf/cli@0.9.0Install the tool has downloads for every system and how to check them. Check that it runs:
$ laminapdf --versionlaminapdf 0.9.0Make a PDF
Section titled “Make a PDF”Save this Markdown as notes.md:
---title: Release noteslang: en---
# Release notes
The new version opens **twice as fast** and reads files with broken cross-references.
| Change | Pages || --- | --- || Faster open | 1 to 3 || Repairs | 4 |Then build it. build lays it out on A4 pages:
$ laminapdf build notes.md -o notes.pdfbuilt 1 page → notes.pdf (3 KB)Look at what you made
Section titled “Look at what you made”info describes the PDF, and check reads all of it and reports anything wrong. The front matter’s title became the document’s title, and the PDF is tagged, so screen readers can follow its headings and table:
$ laminapdf info notes.pdfnotes.pdf PDF 1.7 · 1 page · 3 KB · not encrypted · taggedTitle: Release notesPages: 595.28 × 841.89 pt$ laminapdf check notes.pdfnotes.pdf: ok · 1 page · 33 objectsRead it back
Section titled “Read it back”extract reads the text back in reading order, here as Markdown, with the table as a table:
$ laminapdf extract notes.pdf --format md# Release notes
The new version opens twice as fast and reads files with broken cross-references.
| Change | Pages || --- | --- || Faster open | 1 to 3 || Repairs | 4 |See the page
Section titled “See the page”render draws the page as a PNG image, at 150 dots per inch. Open notes.png, or notes.pdf in any PDF viewer:
$ laminapdf render notes.pdf -o notes.pngpage 1: 1240 × 1753 px → notes.pngWhat happened
Section titled “What happened”build read the Markdown and set it in Helvetica, one of the standard 14 fonts that PDF viewers have; code would use Courier. It wrote a tagged PDF with no creation date, so the same file always gives the same bytes. info, check, extract and render each opened that PDF and printed what they found.
Next, see what else the tool does in the command line, or make the same PDF with your own fonts and an accessibility profile.
Use Lamina PDF with coding agents
A coding agent guesses a new library’s names from what it saw in training, which may be an older version or none at all. Each package therefore carries its own copy of these docs as Markdown. The copy sits in node_modules/@laminapdf/sdk/docs/ for TypeScript and in the laminapdf crate’s docs/ folder for Rust, and every file names the version it describes.
Add the snippet to your agent’s instructions
Section titled “Add the snippet to your agent’s instructions”Copy this snippet into your project’s AGENTS.md, CLAUDE.md or the file your agent reads. It sends the agent to the installed docs first, and it lists the rules where Lamina PDF differs from other PDF libraries:
## Lamina PDF
This project uses Lamina PDF (`@laminapdf/sdk` in TypeScript, the `laminapdf` crate in Rust) to create, read, edit and save PDF files.
- **Read the installed docs first.** They match the installed version: `node_modules/@laminapdf/sdk/docs/llms.txt` lists every page, and `docs/api/` holds the API reference. In Rust they are in the `laminapdf` crate's `docs/` folder. Online: https://docs.laminapdf.com/llms.txt (the latest version).- **Call `await init()` once before anything else.** After it every call is synchronous. Fonts and text need `await init({ text: true })`; reading text needs the extract or text module (`await init({ extract: true })` or `{ text: true }`). Rust needs no setup.- **Positions are points from the top-left corner** of the page as it is displayed, with y going down. A text position is its baseline. Page numbers in the API start at 0 (`page(0)` is the first page).- **Branch on an error's `code`, never its message.** Every error is a `LaminaPdfError` with a stable `code` (such as `wrong-password`) and a `hint`; `docs/errors/<code>.md` explains each one. Warnings, which say what Lamina PDF repaired in a damaged file, use the same codes.- **Free what you open.** A `Document` or `Builder` holds WebAssembly memory: declare it with `using`, or call `free()` when you are done.- **Check `docs/renames.json`** when a name in older code or an older answer doesn't exist: it says what each renamed item is called now.- **Prose goes in as Markdown.** `builder.markdown(text, { fonts, images })` (Rust: `Builder::markdown`) turns CommonMark (with tables, footnotes and task lists) into tagged pages; front matter (`title:`, `lang:`) sets the metadata. Pass images by the name the Markdown uses; nothing is fetched. Without `fonts`, only Latin text can be set, and PDF/UA-1 refuses the unembedded fonts. Without code: `laminapdf build report.md -o report.pdf --font regular=FILE`, or the MCP tool `laminapdf_build` from `laminapdf mcp --root DIR --allow-write`.- **Data-driven layouts go in as JSON.** `laminapdf.document/1` describes flowing pages (`schema`, `page`, named `styles`, `blocks` tagged by `type`). In TypeScript, `builder.flow(document, { data, fonts, images })` lays it out; type it as `FlowDocument`, or as `FlowTemplate` when it holds placeholders (`{ $data: "/ptr" }`, `{ $item: "/ptr" }`, `{ $each: "/list", do }`, `{ $if: "/flag", do }`, which nest) that `data` fills; `tsc` refuses a misspelt key in an object literal. Fonts and images go by the names its styles and figures use. Its `profiles` are not applied for you: pass `template.profiles` to `new Builder({ profiles })`. Errors: `invalid-document` (`data.pointer`, `didYouMean`), `template-data-missing` (`data.pointer`). Examples: `invoice-from-json.ts` (a template and its data), `flowing-report.ts` (a contents page, footnotes, a running header, Arabic and Hindi) and `flowing-invoice.ts` (a table across pages). In Rust, `flow::document::fill(template, data)` and `Builder::document`. Without code: `laminapdf build invoice.json --data data.json --font regular=FILE --font bold=FILE -o invoice.pdf` (one `--font NAME=FILE` per font the document names), or `laminapdf_build` with `document` and `data` inline. Check a document you write against its schema, which this package ships as `docs/schemas/document.schema.json`. Put totals and dates in the data already formatted: templates have no expressions.- **Text comes out in reading order.** `doc.extract({ format })` needs the extract or text module. `"text"` and `"markdown"` return a string, `"json"` an `Extraction` (every block with its kind, page and box) and `"chunks"` a `Chunk[]` for retrieval. Hidden text (under a box, white on white, off the page, too small) never reaches the output; the JSON counts what was dropped. Examples: `extract-text.ts`, `extract-markdown.ts`, `extract-chunks.ts`. In Rust, `Document::extract` and `extract_json`. Without code: `laminapdf extract report.pdf --format md` (or `json`, `chunks`).- **The `laminapdf` command does the same without code.** `info` describes a file, `check` reports what was repaired and failed redactions, `extract` writes text, Markdown, JSON or chunks, `render` writes pages as PNG, `reveal` lists what a file holds beyond its pages (earlier revisions, metadata, attachments, scripts, hidden text; `--fail-on` exits 6), `build` makes a PDF from Markdown or `laminapdf.document/1` JSON, and `pages rotate` turns pages. `--json` prints a versioned report. `laminapdf mcp --root DIR` serves `laminapdf_check`, `laminapdf_explain`, `laminapdf_extract`, `laminapdf_info` and `laminapdf_reveal` to MCP agents; `--allow-write` adds `laminapdf_build`, `laminapdf_pages_rotate` and `laminapdf_render`. `@laminapdf/sdk` has no `reveal` yet.What the package docs hold
Section titled “What the package docs hold”The folder starts at llms.txt, an index in the llms.txt format whose links stay inside the folder:
pages/: every page of this site as Markdown, with the examples written out in full.errors/: a page per error and warning code, the same text as the code pages.api/: the TypeScript API reference (npm package only; Rust’s is on docs.rs).renames.json: what each renamed item is called now, so an agent holding an old name finds the new one.AGENTS.md: the snippet above.
The same docs online
Section titled “The same docs online”This site serves the same Markdown for the latest version. Each page has a twin at its address with .md in place of the final slash, such as /install.md, and /llms.txt lists them all. /llms-full.txt puts every page in one file for agents that read a whole site at once. Prefer the package copy while you work in a project, because it matches the code the agent calls.
Every page also names its twin in a <link rel="alternate" type="text/markdown"> tag, so an agent that fetches a page’s HTML finds the Markdown. To paste one page into a chat, press Copy as Markdown at the top of the page.
Read offline
Each section of these docs is also on one page, so you can read it straight through, print it or save it for later:
- Start here
- Your runtime
- Concepts
- Create PDFs
- Read and edit PDFs
- Show PDFs
- Command line
- Production
- Recipes
- The reader
- Troubleshooting
Download the whole guide as one PDF: every section above in order, with a contents page and bookmarks. Lamina PDF built it from these pages' Markdown with the Markdown builder behindlaminapdf build.
The API reference stays on the site: the TypeScript reference and the Rust reference on docs.rs. Each package also ships these docs as Markdown for coding agents: see Use Lamina PDF with coding agents.