Pressjet
← All articles
Migration

Move one invoice off Gotenberg

Keep the HTML, switch one export, and use a real invoice to decide when to move the rest.

The most revealing invoice in a migration is often the one where the total falls on a page of its own. A short customer name and three tidy rows will print almost anywhere. A long address, a logo and the last row at the page boundary tell you whether a renderer fits your application.

Start with the HTML you already send

Pick one invoice template and save its populated HTML and its current Gotenberg PDF. Include a one-page invoice, a multi-page invoice and a copy whose last row just fits. Keep the customer data synthetic so the team can share these fixtures. Write down what has to survive the move: line-item order, currency precision, page numbers and a readable final total.

Send the markup to POST /v1/html. The API compiles it with the native engine, and the response header x-pressjet-engine: native says so. Render any client-side content before submitting the document. Bundle print CSS and attach PNG or JPEG assets by name. Nothing is fetched: the compiler reads only the markup and attachments you send. Here is a request for an invoice with inline CSS and no external assets.

jq -n --rawfile html invoice.html '{version: 1, html: $html}' |
  curl --fail-with-body -sS http://localhost:8080/v1/html \
    -H "Authorization: Bearer $PRESSJET_API_KEY" \
    -H 'Content-Type: application/json' \
    --data-binary @- -o candidate.pdf

Give both PDFs the same inspection

Extract the text from each with pdftotext -layout. Check every amount and item in order. Then open the longest invoice and inspect the page immediately before the total. Look at the repeated column headings and the bottom margin. Font or spacing changes can move a row across a page boundary while leaving every extracted character intact.

Route a small set of exports through the new path once those checks pass. Keep the previous route available while you measure latency for your own documents. In Pressjet’s 500-item, 17-page invoice test, the HTML endpoint took 53.82 ms and Gotenberg took 344.16 ms at the median. Rebuilding that invoice as native JSON took 30.88 ms. Moving the existing HTML is a useful migration in its own right.

What the HTML compiler reads · Measured invoice workloads

Read nextOne layout, 200 shipping labelsAll articles ↗