Repository avatar
Other Tools
v0.1.0-beta.5
active

pressjet

dev.pressjet/pressjet

Validate, render, preview, merge and sign PDFs with the native Pressjet engine.

Documentation

Pressjet folded P

Pressjet

Generate PDFs from JSON or HTML with a Rust engine.
Build reusable document layouts with automatic pagination, or print existing HTML with print CSS.
Run the CLI on Linux or self-host the HTTP API. SDKs are available for TypeScript, Python, Go and PHP.

Try the browser playground Download Pressjet Beta 5 Self-host Pressjet with Docker

Quick start · Document format · SDKs · Interactive benchmarks · Blog

Continuous integration status on main Engine and API license FSL-1.1-ALv2 SDK and specification license Apache 2.0

Sample invoice rendered by Pressjet from native JSON Sample dispatch slip rendered by Pressjet from a native template

Sample PDFs rendered by Pressjet. Invoice · Dispatch slip

Measured performance

17 pages in 30.88 ms. On a 500-item invoice, Pressjet served native JSON in 62.4–98.2% less time than Gotenberg, Browserless, dompdf, jsPDF, react-pdf and WeasyPrint, and the same invoice from HTML in 53.82 ms. These are median HTTP times from 21 warm sequential requests per configuration on one logical CPU. Compare timings, CPU and memory · Method and data

A 47-page lease in 116.2 ms from the same HTML. Gotenberg took 405.6 ms and peaked at 569 MiB; Pressjet peaked at 22 MiB with the same pages, text and page starts. Migration benchmark

Agents spend less with Pressjet. Claude Code used 38.7% fewer output tokens and 29.0% less time, and Codex 52.8% and 45.0%, than with their own PDF code. Agent study

20 pages in 24.4 ms over HTTP. The batch of itemized invoices took a median of 24.4 ms from Pressjet JSON and 332.1 ms from Gotenberg HTML. At 200 pages the medians were 269.4 ms and 1,237.0 ms. Invoice downloads · Benchmark and raw data

Why Pressjet

  • Fast at every length. Between 1.3 and 2.6 ms of CPU per page from 1 to 500 pages in the page-count benchmark. Pagination lays out only what decides the next page break.
  • Small and self-contained. One Rust binary, fonts compiled in, no browser, no LibreOffice, no shell in the image. The server answered its health check 6 to 7 ms after starting, and a fresh container used 2.8 MiB of memory. Measurement
  • Bounded rendering. The native engine validates JSON against a closed schema and reads no files during rendering. HTML is compiled into the same closed format inside the API. The optional HTML reference service runs without external network access and uses attached images and deployment-installed fonts. Both paths enforce admission, memory limits and deadlines.
  • A real API. API keys, per-key rate limits, browser keys locked to your origins, error answers that say exactly what is wrong and where, Prometheus metrics, and key rotation without a restart.
  • Everything PDFs need. Generate, preview as PNG, draw long flowing text, merge, rasterize and sign (PAdES).
  • Made for AI agents too. pressjet render says what is wrong with the page as data, each problem with its place and its fix, so an agent corrects a document without looking at it. What that costs, measured
  • SDKs everywhere. TypeScript (with JSX, no React needed), Go, PHP and Python, all built from one specification.

Quick start

Export a PDF from a Node.js app

import { writeFile } from "node:fs/promises";
import { document, page, text } from "pressjet";
import { renderLocal } from "pressjet/local";

const invoice = document({ title: "Invoice 42" }, page({}, text({}, "Invoice 42")));
await writeFile("invoice-42.pdf", await renderLocal(invoice));

The release package selects a native executable for Linux x64 or ARM64 when installed with its matching native package. The app runs it on demand. For source builds and custom executable paths, see the local SDK instructions.

Generate a PDF with an AI-authored layout

Give the model the field names and the design brief once. Bind application data to the saved JSON template and pass the resulting native document to renderLocal. A known layout can render any number of records without another model call. The SDK includes a template authoring command and three starter designs. Authoring guide · Live model trials · 1–200 page measurements

Render over HTTP

Run the server:

export PRESSJET_API_KEY="$(openssl rand -hex 32)"
docker run -d --rm -p 127.0.0.1:8080:8080 -e PRESSJET_API_KEY ghcr.io/tonysantana1492/pressjet:0.1.0-beta.5

To build the image from a source checkout: docker build -t ghcr.io/tonysantana1492/pressjet:0.1.0-beta.5 .

Render from TypeScript:

npm install pressjet@0.1.0-beta.5
import { Pressjet, document, page, text, view } from "pressjet";

const pressjet = new Pressjet({ apiKey: process.env.PRESSJET_API_KEY });

const pdf = await pressjet.generate(
  document({ title: "Invoice 42" },
    page({ size: "A4", style: { padding: 40, fontSize: 11 } },
      view({ style: { flexDirection: "row", justifyContent: "space-between" } },
        text({ style: { fontSize: 22, fontWeight: "bold" } }, "Invoice"),
        text({}, "No. 42")),
      text({ style: { marginTop: 24 } }, "Thank you for your business."))));

Or with JSX, by setting "jsxImportSource": "pressjet" in tsconfig.json:

import { Document, Page, Text } from "pressjet";

const invoice = (
  <Document title="Invoice 42">
    <Page size="A4" style={{ padding: 40 }}>
      <Text style={{ fontSize: 22, fontWeight: "bold" }}>Invoice</Text>
    </Page>
  </Document>
);

Or with plain HTTP:

curl -s http://localhost:8080/v1/generate \
  -H "authorization: Bearer $PRESSJET_API_KEY" -H "content-type: application/json" \
  -d '{"version":1,"layout":{"type":"document","properties":{},"children":[
        {"type":"page","properties":{"size":"A4"},"children":[
          {"type":"text","properties":{},"children":["Hello, PDF"]}]}]}}' > hello.pdf

Pressjet for Claude Code

Install the plugin from the Pressjet marketplace on Linux x86-64 or ARM64 with Node.js 22 or newer. Run this command in Claude Code.

/plugin install pressjet --marketplace tonysantana1492/pressjet

The plugin bundles the Pressjet Agent Skill and launches the pinned npm package over local MCP. npm downloads the package on first use. Pressjet processes document and template files in your workspace and writes PDFs there. Pressjet makes no network requests while rendering. Use /mcp to check the connection. MCP setup and two-page invoice example

Print an existing HTML invoice

Call await pressjet.html(populatedHtml): the HTML and its print CSS compile into the native format and render with the same engine. Five lease documents print page for page as Chrome prints them (lease benchmark), with @page margin boxes, running headers, tables with repeated headers, @font-face and PDF/A-2b or PDF/UA-1 output. A WeasyPrint reference service can be added with engine: "reference". What the compiler reads · Deployment

Show where a document came from

Add "verification": { "id": "OH-2026-0417", "url": "https://verify.example.com/check" } to a document and every page carries a QR, PDF417 or Data Matrix code in its margin with the document id, a digest of the source, the page number and an Ed25519 signature. /v1/verify reads a scanned code back and says whether it matches the source. Barcodes are also a node of their own. Barcodes and verification codes

SDKs

LanguageBeta installationSource
TypeScript / JavaScriptSDK tarball and matching Linux renderer for local exportTypeScript SDK
PythonUniversal wheel for Python 3.11+Python SDK
Gogo get github.com/tonysantana1492/pressjet/sdks/go@v0.1.0-beta.5Go SDK
PHPZIP as a Composer path repositoryPHP SDK
Other languagesHTTP + JSONOpenAPI

Copy the beta installation commands.

Every SDK builds the same conformance document in its tests, so a document means the same thing in every language. How SDKs behave is fixed in docs/sdk-design.md.

The document format

A document is a tree of five node kinds:

NodeHoldsLike
documentpages; title, authorthe file
pageblocks; size (LETTER, A4, LEGAL, A5)a page template that flows onto as many pages as it needs
viewblocksa div with display: flex
textstrings, nested text spans, imagesa paragraph
imagePNG or JPEG as base64an img

Styles are a flexbox subset of CSS in camelCase (flexDirection, justifyContent, padding, borderRadius, fontWeight…) with points, mm, cm, in, %, vw and vh. fixed repeats a node on every page (headers and footers), wrap: false keeps a block on one page, break starts a new page, and pageNumberText prints "Page 3 of 12". The full guide is docs/document-format.md; the machine-readable schema is spec/document.schema.json.

If you know react-pdf, you already know the format: the node kinds and style names are the same.

Self-hosting

One image, configured with environment variables:

docker run -d -p 8080:8080 \
  -e PRESSJET_API_KEYS_FILE=/keys/keys.json -v $PWD/keys:/keys:ro \
  ghcr.io/tonysantana1492/pressjet:0.1.0-beta.5
docker run --rm ghcr.io/tonysantana1492/pressjet:0.1.0-beta.5 keys new --id my-backend

prints a new key and the line to add to the key file. The file is re-read when it changes, so keys rotate without a restart. Secret keys (pj_sk_) are for servers; publishable keys (pj_pk_) work only from the browser origins they list. Everything is in docs/self-hosting.md, including rate limits, signing certificates, metrics, scaling and the security model. A Compose file and a Kubernetes manifest are in deploy/.

Agents

An AI agent that can run a command can make a PDF with Pressjet. It writes the document as JSON, runs one command and reads a report:

$ pressjet render doc.json -o out.pdf
out.pdf: 4 pages, 1 error
error missing_glyph at /children/0/children/2 (page 4): 1 character(s) have no glyph in the embedded fonts and print as empty boxes: U+4E2D
  fix: Replace them with characters the fonts cover (Latin, Greek, Cyrillic, punctuation, currency, arrows, mathematical and technical symbols), or draw them as an image.

The report covers what a model cannot see without rendering and looking: characters with no glyph, content past the page edge or larger than its box, overlapping lines, words broken by a narrow column, a nearly empty last page, a heading left at the foot of a page, and every unknown key at once with its replacement. It is specified in docs/layout-report.md and served at POST /v1/check. The Agent Skill teaches an agent the format; pressjet guide prints the same guide. More in docs/agents.

Measured PDF exports with Claude Code and Codex

With Pressjet, Claude Code used 38.7% fewer output tokens, 11.7% less total input and 29.0% less time; Codex used 52.8% fewer output tokens, 37.5% less total input and 45.0% less time. Every PDF made with Pressjet passed the independent checks.

On 29 November 2026 each agent produced the same four documents (a 140-line invoice, a report with a table and a running header, a technical data sheet and a contract) five times with its own tools and five times with Pressjet available. The prompt never mentions Pressjet; in the Pressjet condition the agent finds the Agent Skill and the pressjet binary and decides for itself. Codex ran with a home that held only its login, so no skill installed on the machine reached either condition. Values are means per assigned export. Total input includes cache reads; fresh input excludes them. Time is wall clock for the whole CLI session. USD is Claude Code's own estimate; Codex reports none.

AgentWorkflowPDFs passingTotal inputFresh inputOutputTime
Claude CodeDefault20/20120,17812,2682,44119.9 s
Claude CodePressjet20/20106,1556,5951,49714.1 s
CodexDefault19/20139,2889,9962,17851.9 s
CodexPressjet20/2086,99810,4281,02828.5 s

Every task improved for both agents. In the interleaved run, where both conditions alternated, Claude Code's estimated cost fell 11.1%; the Pressjet sessions above were rerun as a separate batch after a fix, with a warm prompt cache, so their fresh input and cost are not compared here. Study, per-task results and caveats · Per-run CSV

What made the difference, found in the session transcripts of an earlier study:

  • A short skill. Reading the skill adds about 1,650 tokens to Claude Code's context, against about 3,600 before, and it points to pressjet guide <topic> for the rest. A loaded skill is read again on every turn, so its size is paid many times.
  • One command that also checks. pressjet render build.py -o out.pdf runs the agent's script, renders the JSON it prints and lists the first and last line of each page as the PDF's text reads. The agent needs no pdftotext, page images or verifier of its own.
  • A table node and hideOnFirstPage. A table with a repeating header is one node with columns and rows, and a running header from page 2 on is one property, so the agent writes less and guesses nothing.

The earlier study, on 28 November, found the opposite for Claude Code (27.8% more input) and overstated Codex's input savings: its default arm read a ReportLab skill installed on the benchmark machine. That study · Intermediate study with the short skill only

When an application already has a reviewed layout, the template CLI renders it with no layout work by the model: naming the installed template cut 200-page dispatch output by 32.3% for Claude Code and 28.9% for Codex. Guided-session results · Template authoring and scaling

These measurements use Claude Code 2.1.310 with Sonnet 5.5 and Codex CLI 0.164.0 with GPT-6.1 Terra on one host. Five repetitions of four documents is limited evidence for other documents, models or machines. Poppler checked selectable content, pagination and selected geometry; visual design needs separate review.

Benchmarks

Measured on 29 November 2026 with the binary built from this source, on an Intel Core i7-1265U running Linux. Each service ran in its own container with one pinned logical CPU and 1 GiB. CPU time and memory come from each container's cgroup v2 counters; memory is sampled every 5 ms, so shorter peaks can be missed.

Against other PDF services

Each renderer produced the same invoice with 1, 100 and 500 line items. Gotenberg, Browserless, WeasyPrint and Pressjet HTML received the same HTML and print CSS. dompdf implements CSS 2.1 without flexbox, so it received the same invoice as an HTML table, and its adapter wrote the page footer with dompdf's page_text. jsPDF draws at coordinates; its adapter built the same invoice with jspdf-autotable, jsPDF's table plugin, which paginates the rows. Pressjet JSON received the equivalent document tree and the react-pdf adapter built React components. One client sent warm requests in turn; each size had one warm-up per renderer and 21 measured rounds in rotating order. Poppler checked every item, amount, total and page footer of every PDF.

The 500-item invoice (17 pages; dompdf laid it out on 18):

RendererMedian (ms)p95 (ms)CPU (ms)Peak RAM (MiB)PDF (KiB)
Pressjet JSON30.8848.4630.2927.5363.3
Pressjet HTML53.8279.2853.3927.3470.7
jsPDF 4.2.182.12131.5380.6948.63357.4
Gotenberg 9.10.3344.16412.84343.41456.2853.1
Browserless Chromium 2.64.4584.34748.78550.95810.52375.2
dompdf 3.1.6694.651,089.43691.15100.3832.9
WeasyPrint 70.01,730.392,588.691,689.33107.8650.7
react-pdf 4.9.21,739.832,509.941,709.27129.3248.7

With native JSON, Pressjet took 62.4% less time than jsPDF and 91.0% to 98.2% less than the other five services; from the same HTML, 34.5% less than jsPDF and 84.4% to 96.9% less than the rest. Its peak memory was 27.5 MiB against 48.6 to 810.5 MiB for the others. dompdf and react-pdf wrote the smallest files, and jsPDF one of the largest.

Renderer1 item · 1 page100 items · 4 pages500 items · 17 pages
Pressjet JSON1.87 ms7.77 ms30.88 ms
Pressjet HTML2.53 ms13.19 ms53.82 ms
jsPDF 4.2.13.09 ms23.58 ms82.12 ms
Gotenberg 9.10.3247.72 ms282.96 ms344.16 ms
Browserless Chromium 2.64.4409.19 ms473.95 ms584.34 ms
dompdf 3.1.67.24 ms100.13 ms694.65 ms
WeasyPrint 70.0220.51 ms549.68 ms1,730.39 ms
react-pdf 4.9.212.30 ms236.22 ms1,739.83 ms

jsPDF, dompdf and react-pdf are fast at one page; dompdf and react-pdf slow down most as the document grows. The browser-based services spend about 250 to 410 ms even on one page.

HTTP time, CPU time, CPU use and peak RAM for eight rendering paths at 1, 100 and 500 invoice items

Every request · Medians and p95 · Method and reproduction

Moving documents off Gotenberg

Five lease documents were printed from the same HTML and CSS by Gotenberg 8.39 (Chromium 156) and by Pressjet, and from native JSON by Pressjet. Each cell shows the median HTTP time, CPU time and sampled peak memory of seven warm requests. Every Pressjet PDF had Chromium's page count, and the lease check confirms the same text and page starts on every page.

DocumentPagesGotenberg HTMLPressjet HTMLPressjet JSON
Notice2217.1 ms · 215.2 ms CPU · 533.5 MiB5.4 ms · 4.8 ms CPU · 12.1 MiB4.3 ms · 4.0 ms CPU · 11.8 MiB
Addendum4257.4 ms · 252.6 ms CPU · 538.9 MiB11.4 ms · 10.8 ms CPU · 12.6 MiB9.3 ms · 8.8 ms CPU · 12.6 MiB
Lease, 16 clauses10273.8 ms · 271.6 ms CPU · 542.5 MiB29.4 ms · 28.1 ms CPU · 14.7 MiB21.0 ms · 20.1 ms CPU · 14.4 MiB
Lease, 40 clauses20284.1 ms · 282.8 ms CPU · 547.5 MiB53.2 ms · 52.5 ms CPU · 16.3 MiB43.6 ms · 42.8 ms CPU · 16.3 MiB
Lease, 104 clauses47405.6 ms · 404.7 ms CPU · 569.2 MiB116.2 ms · 114.0 ms CPU · 22.4 MiB99.0 ms · 98.1 ms CPU · 22.1 MiB

On the 47-page lease, moving the same HTML to Pressjet cut HTTP time by 71.4%, CPU time by 71.8% and peak memory by 96.1% (569 MiB to 22 MiB). Method and page-for-page check · Individual requests · Move one invoice off Gotenberg

Invoice batches

A batch of synthetic invoices, one per page with 6 to 8 line items and an embedded logo, went to Pressjet as JSON and to Gotenberg 9.10.3 as equivalent HTML. Medians of seven requests after a warm-up: 20 pages in 24.4 ms with Pressjet and 332.1 ms with Gotenberg; 200 pages in 269.4 ms and 1,237.0 ms. Benchmark and raw data

Page count and concurrent clients

The same synthetic invoice at growing lengths, Pressjet from JSON and Gotenberg 9.10.3 from HTML, five requests per size (median), each a different document so no cache answered:

PagesPressjetPressjet CPU per pageGotenberg 9.10.3
11.7 ms1.3 ms254.5 ms
611.3 ms1.6 ms279.0 ms
5086.6 ms1.7 ms615.2 ms
100170.9 ms1.7 ms1,021.4 ms
200416.9 ms2.0 ms2,006.5 ms
5001,360.0 ms2.6 ms4,351.1 ms

Pressjet ran with one worker, PRESSJET_MAX_NODES=100000 and, for 500 pages only, PRESSJET_WORKER_HEAP_MB=900; with the default 512 MiB worker heap the 500-page document fails. With 8 concurrent clients sending one-page documents for 20 s, Pressjet completed 791 documents per second (p95 13.7 ms) and Gotenberg 2.6 (p95 4.8 s); with one client, 593 and 3.5. Raw results · Benchmark script

Earlier runs, kept for reference: 27 November five-renderer run.

Project layout

crates/pressjet-engine   the engine: layout, pagination, PDF writing, raster, merge, sign
crates/pressjet-server   the `pressjet` binary: HTTP server, worker pool, keys, CLI
spec/                    JSON Schemas, OpenAPI, conformance fixtures
sdks/                    typescript, go, php, python
docs/                    guides and design notes
deploy/                  Compose and Kubernetes examples
bench/                   benchmark scripts

Sponsors

Sponsorship helps maintain the Pressjet engine and SDKs, run compatibility tests, and keep the documentation and examples up to date.

Sponsor Pressjet on GitHub

License

Pressjet is fair source: the engine and server are under the Functional Source License 1.1 (FSL-1.1-ALv2), and the SDKs and specification are under Apache 2.0.

In short: use, modify and self-host Pressjet for any purpose, commercial included, except offering it to others as a competing PDF rendering product or service. Each release becomes Apache 2.0 two years after it is published. docs/licensing.md explains what is and is not allowed.

Contributing

Issues and pull requests are welcome; read CONTRIBUTING.md first. Report security issues privately as described in SECURITY.md.

NPM
pressjet
Install Command
npm install pressjet
PYPI
pressjet
Install Command
pip install pressjet