---
title: "Start here, on one page"
description: "Every page of the docs' Start here section, in order, on one page."
version: "0.9.0"
url: "https://docs.laminapdf.com/one-page/start-here/"
---

# Start here, on one page

Every page of the docs' Start here section, in order, on one page.

## Lamina PDF

Create, read, edit and save PDFs from Rust and TypeScript, with one Rust core that runs natively and as WebAssembly.

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.

- **[`laminapdf`](https://crates.io/crates/laminapdf)** on crates.io is the Rust crate. Its [API reference](/reference/rust.md) is on docs.rs.
- **[`@laminapdf/sdk`](https://www.npmjs.com/package/@laminapdf/sdk)** on npm is the TypeScript API over the WebAssembly build. After one `await init()`, every call is synchronous, and the API is the same in every runtime. Its [API reference](/reference/sdk/readme.md) is on this site.

> **Versions:** Install the version these docs describe: `npm install @laminapdf/sdk@0.9.0` and `cargo add laminapdf@0.9.0`. From `0.2.0` on, both follow SemVer, so later releases in the same `0.x` line need no change to your code. [Install](/install.md) lists every published package.

### 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](/guides/fonts-and-text.md), [Images and vectors](/guides/images-and-vectors.md) |
| Navigate | Links, named destinations, outlines, page labels, Info and XMP metadata | [Links, outlines and metadata](/guides/links-outlines-and-metadata.md) |
| Edit | Ops in transactions, undo and redo, incremental or full saves that respect signatures | [Edit a PDF](/guides/edit-a-pdf.md), [Save a PDF](/guides/save-a-pdf.md) |
| Extract | Text, Markdown and JSON in reading order, with tables, a box for every block and chunks for retrieval | [Extract text and Markdown](/guides/extract-text.md) |
| Read safely | Repair of damaged files as warnings, resource limits, strict mode, passwords | [Open password-protected files](/guides/password-protected-files.md), [Open files you don't trust](/guides/untrusted-files.md) |
| Errors | One coded error and warning shape on every surface | [Errors and warnings](/concepts/errors-and-warnings.md) |

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

Start with your first PDF [in TypeScript](/start/first-pdf.md), [in Rust](/start/first-pdf-rust.md) or [on the command line](/start/first-pdf-cli.md), then read [how Lamina PDF thinks about a PDF](/concepts/how-lamina-thinks.md). When you're ready for your own setup, pick [your runtime](/quick-start/browser.md). To read away from the site, see [Read offline](/start/offline.md): each section on one page, and the whole guide as one PDF.

## Choosing a PDF library for TypeScript or Rust

Which PDF library should you use in TypeScript or Rust? What pdf-lib, PDF.js, PDFKit, lopdf, krilla and others do, with sources, and where Lamina PDF fits.

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](https://github.com/laudebugs/laminapdf/issues) and we'll correct it.

### 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

| Library | Make | Read | Text | Render | Edit | Forms | Sign | PDF/A, PDF/UA |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [pdf-lib](https://github.com/Hopding/pdf-lib) | [Yes](https://github.com/Hopding/pdf-lib#features) | [Yes, not encrypted files](https://github.com/Hopding/pdf-lib#encryption-handling) | [No](https://github.com/Hopding/pdf-lib#limitations) | — | [Partly: pages, not their text](https://github.com/Hopding/pdf-lib#limitations) | [Yes: create and fill](https://github.com/Hopding/pdf-lib#creating-and-filling-forms) | [No](https://pdf-lib.js.org/docs/api/classes/pdfsignature) | — |
| [LibPDF](https://github.com/LibPDF-js/core) | [Yes](https://github.com/LibPDF-js/core#features) | [Yes](https://github.com/LibPDF-js/core#features) | [Yes](https://libpdf.documenso.com/docs/guides/text-extraction) | — | [Yes](https://github.com/LibPDF-js/core#features) | [Yes: create and fill](https://libpdf.documenso.com/docs/api/pdf-form) | [Partly: signs, doesn't verify](https://github.com/LibPDF-js/core#known-limitations) | — |
| [PDFKit](https://github.com/foliojs/pdfkit) | [Yes](https://github.com/foliojs/pdfkit#description) | [No](https://github.com/foliojs/pdfkit#pdfkit) | [No](https://github.com/foliojs/pdfkit#pdfkit) | [No](https://github.com/foliojs/pdfkit#pdfkit) | [No](https://github.com/foliojs/pdfkit#pdfkit) | [Partly: create only](https://pdfkit.org/docs/forms.html) | — | [Yes](https://pdfkit.org/docs/accessibility.html) |
| [jsPDF](https://github.com/parallax/jsPDF) | [Yes](https://github.com/parallax/jsPDF#readme) | [No](https://github.com/parallax/jsPDF#readme) | [No](https://github.com/parallax/jsPDF#readme) | [No](https://github.com/parallax/jsPDF#readme) | [No](https://github.com/parallax/jsPDF#readme) | [Partly: create only](https://parallax.github.io/jsPDF/docs/module-AcroForm.html) | — | — |
| [pdfmake](https://github.com/bpampuch/pdfmake) | [Yes](https://github.com/bpampuch/pdfmake#features) | [No](https://github.com/bpampuch/pdfmake#readme) | [No](https://github.com/bpampuch/pdfmake#readme) | [No](https://github.com/bpampuch/pdfmake#readme) | [No](https://github.com/bpampuch/pdfmake#readme) | — | — | [Partly: PDF/A, and PDF/UA as a flag](https://pdfmake.github.io/docs/0.3/document-definition-object/pdfa/) |
| [PDF.js](https://github.com/mozilla/pdf.js) | [No](https://github.com/mozilla/pdf.js#readme) | [Yes](https://mozilla.github.io/pdf.js/examples/) | [Yes](https://github.com/mozilla/pdf.js/blob/master/src/display/api.js) | [Yes](https://mozilla.github.io/pdf.js/examples/) | [Partly: annotations and form values](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-annotations) | [Partly: fill only](https://github.com/mozilla/pdf.js/blob/master/src/display/api.js) | — | [No](https://github.com/mozilla/pdf.js#readme) |
| Lamina PDF | [Yes](/start/first-pdf.md) | [Yes](/guides/untrusted-files.md) | [Yes](/recipes/extract-markdown.md) | [Yes, with a renderer package](/install.md#every-published-package) | [Partly: document info and page rotation](/guides/edit-a-pdf.md) | No | No | [Yes](/guides/accessible-pdfs.md) |

Licences, versions and runtimes, from each package's npm entry and README:

| Library | Licence | Latest release | Runtimes its docs name |
| --- | --- | --- | --- |
| pdf-lib | [MIT](https://www.npmjs.com/package/pdf-lib) | [1.17.1, 6 November 2021](https://www.npmjs.com/package/pdf-lib?activeTab=versions) | [Node, browsers, Deno, React Native](https://github.com/Hopding/pdf-lib#readme) |
| LibPDF | [MIT](https://www.npmjs.com/package/@libpdf/core) | [0.5.3, 16 October 2026](https://www.npmjs.com/package/@libpdf/core?activeTab=versions), marked beta | [Node 20 or later, Bun, browsers](https://github.com/LibPDF-js/core#runtime-support) |
| PDFKit | [MIT](https://www.npmjs.com/package/pdfkit) | [0.20.2, 30 August 2026](https://www.npmjs.com/package/pdfkit?activeTab=versions) | [Node, browsers](https://github.com/foliojs/pdfkit#pdfkit) |
| jsPDF | [MIT](https://www.npmjs.com/package/jspdf) | [4.2.1, 17 March 2026](https://www.npmjs.com/package/jspdf?activeTab=versions) | [Browsers, Node](https://github.com/parallax/jsPDF#install) |
| pdfmake | [MIT](https://www.npmjs.com/package/pdfmake) | [0.3.14, 8 November 2026](https://www.npmjs.com/package/pdfmake?activeTab=versions) | [Node 20 or later, browsers](https://pdfmake.github.io/docs/0.3/getting-started/server-side/supported-nodejs-versions/) |
| PDF.js | [Apache-2.0](https://www.npmjs.com/package/pdfjs-dist) | [6.5.438, 1 November 2026](https://www.npmjs.com/package/pdfjs-dist?activeTab=versions) | [Browsers; Node 22 or later, "mostly"](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support) |
| 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.

### Rust

| Crate | Make | Read | Text | Render | Edit | Forms | Sign | PDF/A, PDF/UA |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [lopdf](https://crates.io/crates/lopdf) | [Partly: you build the objects](https://docs.rs/crate/lopdf/0.47.0/source/README.md) | [Yes](https://docs.rs/lopdf/0.47.0/lopdf/struct.Document.html) | [Yes](https://docs.rs/lopdf/0.47.0/lopdf/struct.Document.html#method.extract_text) | — | [Yes](https://docs.rs/lopdf/0.47.0/lopdf/struct.IncrementalDocument.html) | — | — | — |
| [printpdf](https://crates.io/crates/printpdf) | [Yes](https://docs.rs/crate/printpdf/0.12.8/source/README.md) | [Partly: experimental](https://docs.rs/crate/printpdf/0.12.8/source/README.md) | [Partly: experimental](https://docs.rs/crate/printpdf/0.12.8/source/README.md) | [Partly: to SVG, experimental](https://docs.rs/crate/printpdf/0.12.8/source/README.md) | [Partly: re-save after parsing](https://docs.rs/crate/printpdf/0.12.8/source/src/deserialize.rs) | — | — | [No: PDF/X-3 only](https://docs.rs/crate/printpdf/0.12.8/source/README.md) |
| [pdf-writer](https://crates.io/crates/pdf-writer) | [Partly: you build the objects](https://docs.rs/pdf-writer/0.15.0/pdf_writer/) | [No](https://docs.rs/pdf-writer/0.15.0/pdf_writer/) | — | — | [No](https://docs.rs/pdf-writer/0.15.0/pdf_writer/) | [Partly: writes new fields](https://docs.rs/pdf-writer/0.15.0/pdf_writer/writers/struct.Field.html) | — | [Partly: you build the structure](https://docs.rs/pdf-writer/0.15.0/pdf_writer/writers/struct.StructTreeRoot.html) |
| [krilla](https://crates.io/crates/krilla) | [Yes](https://docs.rs/krilla/0.8.2/krilla/) | [Partly: embeds pages of other PDFs](https://docs.rs/crate/krilla/0.8.2/source/src/surface.rs) | — | — | — | — | [No](https://docs.rs/crate/krilla/0.8.2/source/src/configure/PDF_UA1.md) | [Yes](https://docs.rs/krilla/0.8.2/krilla/configure/index.html) |
| [hayro](https://crates.io/crates/hayro) | — | [Yes, not encrypted files](https://docs.rs/hayro-syntax/0.9.0/hayro_syntax/) | — | [Yes](https://docs.rs/hayro/0.9.0/hayro/) | [No](https://github.com/LaurenzV/hayro/blob/hayro-v0.9.0/README.md) | — | — | — |
| [pdfium-render](https://crates.io/crates/pdfium-render) | [Yes](https://docs.rs/crate/pdfium-render/0.9.5/source/README.md) | [Yes](https://docs.rs/crate/pdfium-render/0.9.5/source/README.md) | [Yes](https://docs.rs/crate/pdfium-render/0.9.5/source/README.md) | [Yes](https://docs.rs/crate/pdfium-render/0.9.5/source/README.md) | [Yes](https://docs.rs/pdfium-render/0.9.5/pdfium_render/pdf/document/struct.PdfDocument.html) | [Yes: fill](https://docs.rs/pdfium-render/0.9.5/pdfium_render/pdf/document/page/field/text/struct.PdfFormTextField.html) | [Partly: reads signatures](https://docs.rs/pdfium-render/0.9.5/pdfium_render/pdf/document/signature/struct.PdfSignature.html) | — |
| Lamina PDF | [Yes](/quick-start/rust.md) | [Yes](/guides/untrusted-files.md) | [Yes](/recipes/extract-markdown.md) | [Yes, with a renderer crate](/install.md#every-published-package) | [Partly: document info and page rotation](/guides/edit-a-pdf.md) | No | No | [Yes](/guides/archival-pdfs.md) |

Licences, versions and what each crate needs, from crates.io and each README:

| Crate | Licence | Latest release | What it needs |
| --- | --- | --- | --- |
| lopdf | [MIT](https://crates.io/crates/lopdf) | [0.47.0, 4 November 2026](https://crates.io/crates/lopdf/versions) | No C library named in its docs |
| printpdf | [MIT](https://crates.io/crates/printpdf) | [0.12.8, 5 September 2026](https://crates.io/crates/printpdf/versions) | Reads PDFs through lopdf; [runs in WebAssembly](https://docs.rs/crate/printpdf/0.12.8/source/README.md) |
| pdf-writer | [MIT or Apache-2.0](https://crates.io/crates/pdf-writer) | [0.15.0, 27 May 2026](https://crates.io/crates/pdf-writer/versions) | [Rust only, no unsafe code](https://docs.rs/crate/pdf-writer/0.15.0/source/README.md) |
| krilla | [MIT or Apache-2.0](https://crates.io/crates/krilla) | [0.8.2, 4 June 2026](https://crates.io/crates/krilla/versions) | Built on pdf-writer |
| hayro | [MIT or Apache-2.0](https://crates.io/crates/hayro) | [0.9.0, 2 November 2026](https://crates.io/crates/hayro/versions) | [Pure Rust, renders on the CPU](https://docs.rs/hayro/0.9.0/hayro/) |
| pdfium-render | [MIT or Apache-2.0](https://crates.io/crates/pdfium-render) | [0.9.5, 1 November 2026](https://crates.io/crates/pdfium-render/versions) | [The PDFium C++ library, which you ship](https://docs.rs/crate/pdfium-render/0.9.5/source/README.md) |
| 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

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](/reference/glossary.md#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](/reference/stability.md) 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](https://app.laminapdf.com/capabilities) 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](https://laminapdf.com/how-we-test/). [Benchmarks](/reference/benchmarks.md) has its timings and download sizes in each runtime.

Next: [Install](/install.md) Lamina PDF, or make [your first PDF](/start/first-pdf.md).

## Install

Install Lamina PDF from npm or crates.io, and find every published package.

Lamina PDF is published to npm as [`@laminapdf/sdk`](https://www.npmjs.com/package/@laminapdf/sdk) and to crates.io as [`laminapdf`](https://crates.io/crates/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`

Install the version these docs describe:

```sh
npm install @laminapdf/sdk@0.9.0
```

Without 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`](https://www.npmjs.com/package/@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](/quick-start/browser.md) show each one.

### Rust: `laminapdf`

Add the crate at the version these docs describe:

```sh
cargo add laminapdf@0.9.0
```

The 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](/reference/stability.md) 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](/start/first-pdf-rust.md) walks through a first program.

### 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](/cli/install.md) has npm and downloads for macOS, Linux and Windows. [Your first PDF on the command line](/start/first-pdf-cli.md) walks through a first session.

### 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](https://www.npmjs.com/package/@laminapdf/sdk) | The TypeScript API, for every JavaScript runtime |
| `@laminapdf/wasm` | [npm](https://www.npmjs.com/package/@laminapdf/wasm) | The WebAssembly modules under `@laminapdf/sdk` |
| `@laminapdf/render` | [npm](https://www.npmjs.com/package/@laminapdf/render) | The interface that page renderers implement ([guide](/guides/render-pages.md)) |
| `@laminapdf/render-pdfium` | [npm](https://www.npmjs.com/package/@laminapdf/render-pdfium) | The default web renderer, built on PDFium ([guide](/guides/render-pages.md)) |
| `@laminapdf/render-hayro` | [npm](https://www.npmjs.com/package/@laminapdf/render-hayro) | A second web renderer, built on hayro ([guide](/guides/render-pages.md)) |
| `@laminapdf/viewer` | [npm](https://www.npmjs.com/package/@laminapdf/viewer) | The core of a web PDF viewer, one worker per document ([guide](/guides/show-a-pdf.md)) |
| `laminapdf` | [crates.io](https://crates.io/crates/laminapdf) | The Rust API: open, read, edit, save and build PDFs |
| `laminapdf-syntax` | [crates.io](https://crates.io/crates/laminapdf-syntax) | Objects, the lexer, the parser and stream filters |
| `laminapdf-cos` | [crates.io](https://crates.io/crates/laminapdf-cos) | File structure: the tolerant reader and the writer |
| `laminapdf-model` | [crates.io](https://crates.io/crates/laminapdf-model) | Typed views of pages, outlines, metadata and labels |
| `laminapdf-ops` | [crates.io](https://crates.io/crates/laminapdf-ops) | Editing ops, transactions, undo and redo |
| `laminapdf-save` | [crates.io](https://crates.io/crates/laminapdf-save) | Incremental and full saves |
| `laminapdf-content` | [crates.io](https://crates.io/crates/laminapdf-content) | The content-stream interpreter |
| `laminapdf-text` | [crates.io](https://crates.io/crates/laminapdf-text) | Fonts, shaping and line breaking |
| `laminapdf-build` | [crates.io](https://crates.io/crates/laminapdf-build) | The builder that generates PDFs |
| `laminapdf-source` | [crates.io](https://crates.io/crates/laminapdf-source) | Byte sources filled range by range, for remote files |
| `laminapdf-render` | [crates.io](https://crates.io/crates/laminapdf-render) | The Rust interface that page renderers implement ([guide](/guides/render-pages.md#in-rust)) |
| `laminapdf-render-pdfium` | [crates.io](https://crates.io/crates/laminapdf-render-pdfium) | The native PDFium renderer ([guide](/guides/render-pages.md#in-rust)) |

*Each JavaScript package and what it depends on, beside the Rust API.*

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

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:

```sh
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" }`.

### API docs

- TypeScript: the [`@laminapdf/sdk` reference](/reference/sdk/readme.md), generated from the package's TSDoc comments.
- Rust: the [Rust API](/reference/rust.md) page, which links each crate's docs on docs.rs.

## Your first PDF

Write hello.pdf from Node in five minutes.

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

You need Node 24.2 or newer, which runs `.ts` files directly. Create a folder and install `@laminapdf/sdk` from npm:

```sh
mkdir hello-pdf && cd hello-pdf
npm init -y && npm pkg set type=module
npm install @laminapdf/sdk@0.9.0
```

The 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](/install.md) covers other package managers and Rust.

### Write the page

Save this app as `hello.ts`. It loads Lamina PDF, builds the page and writes it to `hello.pdf`:

**TypeScript**

`packages/sdk/examples/quick-start/node.ts`:

```ts
// 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();
```

**Result:** [hello.pdf](/examples/pdf/hello.pdf)

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

```sh
node hello.ts
```

Node 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

`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](/concepts/how-lamina-thinks.md) and [where things go on a page](/concepts/pages-and-coordinates.md). To use laminapdf somewhere other than Node, pick [your runtime](/quick-start/browser.md).

## Your first PDF in Rust

Write hello.pdf from a Rust program in five minutes.

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

You need Rust 1.97 or newer. Create a project and add the `laminapdf` crate:

```sh
cargo new hello-pdf && cd hello-pdf
cargo add laminapdf@0.9.0
```

This 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](/reference/stability.md) promises needs no change to your code. [Install](/install.md#rust-laminapdf) covers the crate's features.

### Write the page

Replace `src/main.rs` with this program. It builds the page and writes it to `hello.pdf`:

**Rust**

`crates/laminapdf/examples/hello.rs`:

````rust
//! 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)
}
````

**Result:** [hello.pdf](/examples/pdf/hello.pdf)

### Run it

```sh
cargo run
```

The 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

`Builder` made an A4 page, and the page's surface drew the text in Helvetica, one of the [standard 14 fonts](/reference/glossary.md) 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](/concepts/how-lamina-thinks.md) and [where things go on a page](/concepts/pages-and-coordinates.md). For your own fonts and text that wraps, read [text and fonts](/guides/fonts-and-text.md).

## Your first PDF on the command line

Install the laminapdf command, turn a Markdown file into a PDF, then inspect it and read it back.

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

On macOS and Linux, install it with Homebrew; anywhere npm runs, install it with npm:

```sh
brew install laudebugs/tap/laminapdf
```

```sh
npm install -g @laminapdf/cli@0.9.0
```

[Install the tool](/cli/install.md) has downloads for every system and how to check them. Check that it runs:

```console
$ laminapdf --version
laminapdf 0.9.0
```

### Make a PDF

Save this Markdown as `notes.md`:

```md title="notes.md"
---
title: Release notes
lang: 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:

```console
$ laminapdf build notes.md -o notes.pdf
built 1 page → notes.pdf (3 KB)
```

### 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:

```console
$ laminapdf info notes.pdf
notes.pdf  PDF 1.7 · 1 page · 3 KB · not encrypted · tagged
Title: Release notes
Pages: 595.28 × 841.89 pt
$ laminapdf check notes.pdf
notes.pdf: ok · 1 page · 33 objects
```

### Read it back

`extract` reads the text back in reading order, here as Markdown, with the table as a table:

```console
$ 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

`render` draws the page as a PNG image, at 150 dots per inch. Open `notes.png`, or `notes.pdf` in any PDF viewer:

```console
$ laminapdf render notes.pdf -o notes.png
page 1: 1240 × 1753 px → notes.png
```

### What happened

`build` read the Markdown and set it in Helvetica, one of the [standard 14 fonts](/reference/glossary.md) 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](/cli.md), or make the same PDF [with your own fonts and an accessibility profile](/cli/build-and-edit.md#accessible-and-archival-pdfs).

## Use Lamina PDF with coding agents

Point a coding agent at the docs inside the installed package, so its answers match the version you use.

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

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:

`packages/sdk/examples/AGENTS.md`:

```md
## 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

The folder starts at `llms.txt`, an index in the [llms.txt](https://llmstxt.org/) 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](/reference/codes.md).
- `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

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`](https://docs.laminapdf.com/install.md), and [`/llms.txt`](https://docs.laminapdf.com/llms.txt) lists them all. [`/llms-full.txt`](https://docs.laminapdf.com/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 on one page, and the whole guide as one PDF.

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](/one-page/start-here.md)
- [Your runtime](/one-page/your-runtime.md)
- [Concepts](/one-page/concepts.md)
- [Create PDFs](/one-page/create-pdfs.md)
- [Read and edit PDFs](/one-page/read-and-edit-pdfs.md)
- [Show PDFs](/one-page/show-pdfs.md)
- [Command line](/one-page/command-line.md)
- [Production](/one-page/production.md)
- [Recipes](/one-page/recipes.md)
- [The reader](/one-page/the-reader.md)
- [Troubleshooting](/one-page/troubleshooting.md)

Download [the whole guide as one PDF](https://docs.laminapdf.com/pdf/lamina-pdf-guide.pdf): every section above in order, with a contents page and bookmarks.

The API reference stays on the site: the [TypeScript reference](/reference/sdk/readme.md) and the [Rust reference on docs.rs](/reference/rust.md). Each package also ships these docs as Markdown for coding agents: see [Use Lamina PDF with coding agents](/start/coding-agents.md).
