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
import { readFile, writeFile } from "node:fs/promises";
import { Pressjet } from "pressjet";
const client = new Pressjet({
baseUrl: "http://localhost:8080",
apiKey: process.env.PRESSJET_API_KEY
});
const html = await readFile("invoice.html", "utf8");
const pdf = await client.html(html);
await writeFile("candidate.pdf", pdf);
import { readFile, writeFile } from "node:fs/promises";
import { Pressjet } from "pressjet";
const client = new Pressjet({
baseUrl: "http://localhost:8080",
apiKey: process.env.PRESSJET_API_KEY
});
const html: string = await readFile("invoice.html", "utf8");
const pdf = await client.html(html);
await writeFile("candidate.pdf", pdf);
from os import environ
from pathlib import Path
import pressjet
html = Path("invoice.html").read_text(encoding="utf-8")
with pressjet.Client(api_key=environ["PRESSJET_API_KEY"], base_url="http://localhost:8080") as client:
Path("candidate.pdf").write_bytes(client.html(html))
package main
import (
"context"
"os"
pressjet "github.com/tonysantana1492/pressjet/sdks/go"
)
func must[T any](value T, err error) T {
if err != nil {
panic(err)
}
return value
}
func main() {
ctx := context.Background()
client := pressjet.NewClient()
html := must(os.ReadFile("invoice.html"))
pdf := must(client.HTML(ctx, string(html), nil))
if err := os.WriteFile("candidate.pdf", pdf, 0644); err != nil {
panic(err)
}
}
<?php
require __DIR__ . '/vendor/autoload.php';
use Pressjet\Client;
$client = new Client(
apiKey: getenv('PRESSJET_API_KEY'),
baseUrl: 'http://localhost:8080',
);
$html = file_get_contents('invoice.html');
if ($html === false) {
throw new RuntimeException('Could not read invoice.html');
}
file_put_contents('candidate.pdf', $client->html($html));
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.