Make and change PDFs
Make a PDF from a Markdown file or a JSON document, or turn pages of an existing one. Use build for reports and manuals you write in Markdown, and for invoices a program fills in; the PDF flows across as many pages as it needs, and screen readers can follow it.
A PDF from Markdown: build
Section titled “A PDF from Markdown: build”Take this Markdown file:
---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 |build lays it out on A4 pages and writes the PDF:
$ laminapdf build notes.md -o notes.pdfbuilt 1 page → notes.pdf (3 KB)The PDF is tagged, so screen readers know its headings, paragraphs and tables, and its headings appear in the viewer’s outline. A table’s header row repeats at the top of each page it runs onto. build reads CommonMark with tables, footnotes, strikethrough and task lists, and - as the input reads Markdown from standard input.
Title and language
Section titled “Title and language”The front matter’s title, lang, author and subject lines set the document’s metadata. When the front matter has no title or language, --title and --lang give them; the language is a tag such as en-GB.
Without fonts, build sets the text in Helvetica and Courier, two of the standard 14 fonts that every PDF viewer has. They cover Latin text only, and they aren’t embedded in the file. Give your own fonts by role, and build embeds the characters the document uses:
laminapdf build notes.md -o notes.pdf \ --font regular=NotoSans-Regular.ttf --font bold=NotoSans-Bold.ttf \ --font fallback=NotoSansArabic-Regular.ttfThe roles are regular, bold, italic, bold-italic and mono, for code. fallback, which you may repeat, covers characters the others lack, such as another script. FILE#N takes face N of a font collection (.ttc). A character no font has stops the build with missing-glyph, which names it.
Accessible and archival PDFs
Section titled “Accessible and archival PDFs”--profile checks the PDF against a standard before it writes it: pdf-ua-1 for accessibility, or pdf-a-2b, pdf-a-2u or pdf-a-3b for archiving. You may name PDF/UA-1 and one PDF/A profile together. Both need embedded fonts, so give fonts with --font; without them, the build stops with font-not-embedded.
$ laminapdf build notes.md -o notes.pdf --profile pdf-ua-1 --font regular=NotoSans-Regular.ttf --font bold=NotoSans-RegularBold.ttc#1built 1 page → notes.pdf (14 KB, PDF/UA-1)Accessible PDFs and archival PDFs explain what each profile asks of a document.
Images
Section titled “Images”build reads images from the Markdown file’s folder or the folders below it. It never fetches a remote image or reads one from outside that folder, so a Markdown file you were sent can’t pull other files into the PDF. Such an image is left out with the markdown-image-missing warning, as raw HTML is with markdown-html-ignored, and the build exits 3.
The same input gives the same bytes
Section titled “The same input gives the same bytes”The PDF has no creation date unless --creation-date gives one, such as 20261110. Without a date, the same Markdown and fonts give a byte-identical PDF, so a build job can compare it with the last one.
Page size and reports
Section titled “Page size and reports”--page-size takes a4 (the default), a0 to a6, letter, legal or tabloid. With --json, build prints a laminapdf.build/1 report with the page count, size and profiles.
A PDF from JSON
Section titled “A PDF from JSON”build also reads a JSON document in Lamina PDF’s own format, laminapdf.document/1, which a program or a language model can write. It can be a template whose placeholders --data fills, such as an invoice and its line items:
$ laminapdf build invoice.json --data invoice-data.json --font regular=NotoSans-Regular.ttf --font bold=NotoSans-RegularBold.ttc#1 -o invoice.pdfbuilt 2 pages → invoice.pdf (24 KB, PDF/UA-1)A file whose name ends in .json is a document, and so is standard input holding a JSON object. --data - reads the data from standard input; the document and the data can’t both come from it. Fill an invoice from JSON explains the format and its placeholders.
Fonts and images by name
Section titled “Fonts and images by name”A document names its fonts and images, such as regular and bold above. --font NAME=FILE and --image NAME=FILE give the file for each name. A name you don’t give is read from a file with exactly that name, such as regular, in the document’s folder (the working folder when the document comes from standard input), and never from anywhere else. A standard 14 font name, such as Helvetica, needs no file.
The document sets its own page size, title, language and profiles, so --page-size is refused. --profile adds a profile, and --title and --lang apply only when it gives none.
Errors that say where
Section titled “Errors that say where”A mistake in the document or the data stops the build with exit 2 and says where it is, as a JSON Pointer, a path such as /blocks/2/spaceAftr:
invalid-document: a key the format doesn’t know, with the key it probably meant, or a value of the wrong kind.template-data-missing: a placeholder points at data that isn’t there.template-data-type: the data there is the wrong kind, such as text where a list belongs.
Turn pages: pages rotate
Section titled “Turn pages: pages rotate”pages rotate turns pages by a quarter turn. +90 and -90 turn pages from their current rotation, and 90, 180 or 270 set it. A page range after a colon names the pages; without one, it turns every page:
$ laminapdf pages rotate report.pdf +90:1-3 -o turned.pdfrotated 3 pages → turned.pdf (incremental update)Where the file allows it, the tool writes an incremental update, as its output says: the original bytes stay first in the new file, unchanged, and the change follows them. --in-place replaces the input instead of writing a new file, and needs --force.