Skip to content
Lamina PDF

Recipes

Each recipe is a complete program to copy: what it makes, the code, how it works and what to change. Pick the one closest to the document you need, and change it from there.

Most recipes exist twice, in Rust and in TypeScript, and both write exactly the same bytes. Lamina PDF’s tests check that on every change, in Rust and in every JavaScript runtime: Node, Chromium, Firefox, WebKit, Deno, Bun and workerd. Each recipe shows the tested code, and its reference PDF is the file that code writes.

To run a Rust recipe from a checkout of Lamina PDF, use cargo run -p laminapdf --example <name>. Its header comment lists the arguments it takes, such as the font or image files it reads.

Next: Hello, world, the smallest PDF Lamina PDF writes.