Skip to content

Pressjet for AI agents

An 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 that says what is wrong and how to fix it. No server, no network, no PDF library, and no code written by the model has to run to draw the page.

Export from application data

When the app already has the rows or prose, send the model a field contract and a layout brief. Save its template and bind the real data in the app. A known layout can render again with zero model calls. The Node SDK includes pressjet-template to render or check these documents and three starter layouts. Workflow, prompt and limits

Connect an MCP client over stdio

Build the current source with cargo build --release --locked -p pressjet-server. Configure the client to launch that binary and point it at the directory containing the documents. For clients that use an mcpServers setting, replace the two absolute paths in this example.

{
  "mcpServers": {
    "pressjet": {
      "command": "/absolute/path/to/target/release/pressjet",
      "args": ["mcp", "--workspace", "/absolute/path/to/documents"]
    }
  }
}

The workspace defaults to the launch directory. Copy the invoice template and data into it. Call check_document with the arguments below to get the page count, up to three diagnostics, and the number omitted. Pass the same arguments to render_document for a new PDF.

{"template": "invoice.template.json", "data": "invoice.data.json"}

Both tools also accept {"document":"report.json"} for a native document or a v1 layout request with embedded fonts and images. Inputs are regular files under the workspace. Paths may be relative or absolute. Symlinks and parent traversal are rejected. Input files are parsed as data.

Tool Arguments Result
preview_pages pdf, optional firstPage, count (1–8), scale (0–4, exclusive of 0) Total pages and paths to PNGs of the requested range
merge_pdfs pdfs in reading order (1–32 paths) Path to a merged PDF
sign_pdf pdf and signature with name, reason, signingTime Path to a signed copy. Advertised when the process has a signing certificate
authoring_guide Optional topic Available topics, or the selected section

Output files have unique names in the workspace, remain available after exit, and can be passed directly to another tool. The caller manages their lifetime. Each call has a 32 MiB combined input budget and a 32 MiB combined output budget. One render runs at a time, with up to eight tool calls outstanding per process. The server supports per-request discovery (2026-07-28) and the initialize handshake (2025-11-25). Closing stdin ends the process. Stdio transport

Connect an MCP client over HTTP

Start the source-built server with its usual authentication settings. Set the MCP client's Streamable HTTP URL to http://127.0.0.1:8080/mcp for a local server and configure its Bearer header with your Pressjet API key. Use the deployment's HTTPS URL when connecting remotely. The server responds to each POST with a single JSON reply. Both the 2026-07-28 revision and the sessionless 2025-11-25 initialize flow are supported. Server configuration · Streamable HTTP specification

Call check_document and render_document with the contents of the invoice template and data in the template and data arguments, or send a native JSON object in document. Each returned PDF or PNG has a resource_link with a pressjet://artifacts/… URI. Pass that URI to resources/read, or download the raw bytes with an authenticated GET to the returned structuredContent.downloadPath on the same server. Pass a PDF URI directly to preview_pages, merge_pdfs or sign_pdf. For previews, each entry of structuredContent.pages contains its own URI and download path.

Tools run with the key's existing operation permissions, rate limit and admission limits. Signing requires the server's certificate and permission to sign. Browser clients also need an origin listed for their key. Files belong to the credential that created them. With authentication disabled, callers share one anonymous identity. Tool calls and downloads use the server's memory. Each instance keeps up to 256 files or 64 MiB of artifacts for at most five minutes. Older links can expire sooner under pressure or on restart. Route the render and subsequent reads to the same instance in a multi-replica deployment, and download any file you need to retain.

The three pieces

  1. The binary. pressjet render doc.json -o out.pdf writes the PDF and prints the layout report. pressjet check doc.json prints the report only. --png page --scale 0.6 --pages 1,3 writes chosen pages as images when the agent needs to look.
  2. The guide. pressjet guide prints the format, the rules that prevent most mistakes and the meaning of each diagnostic, in about 1,900 words. It is crates/pressjet-server/src/guide.md.
  3. The Agent Skill. skills/pressjet-pdf carries a short version of the guide as a SKILL.md, so Claude Code, Codex and other agents that read skills pick it up when a task asks for a PDF. It sends the agent to pressjet guide <topic> for the rest.

The loop

write doc.json (by hand, or with a short script for documents built from data)
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 ...: U+4E2D
    fix: Replace them with characters the fonts cover ...
edit the node the pointer names, render again
  out.pdf: 4 pages, no layout problems

The report is the reason this is cheaper than writing a program. A diagnostic is one line of text that names the node to change, where a page preview is an image the model has to read. What each code means, exactly, is in layout-report.md.

Over HTTP

A system that calls the server instead of the binary has the same report at POST /v1/check (same body as /v1/generate; see spec/openapi.yaml). A document that cannot be rendered answers 200 with a report that lists everything refused.

What is measured

bench/agents runs Claude Code and Codex on four PDF tasks with and without Pressjet and publishes every transcript, every PDF and the checks that judged them.

What comes next

plan.md: MCP inside the binary, hosted template storage, and the open specification of the document format and the layout report.