HUB
Sign inSign up

marqius/kern

By marqius

•Updated about 23 hours ago

Gotenberg-compatible PDF server for 8.x and 9.x code. One line to switch, 41 MB image.

Image
0

1.1K

marqius/kern repository overview

⁠Tags

  • 0.12.20, latest: the server, ready to run. One program, its fonts and curl (41 MB).
  • 0.12.20-fonts, fonts: the same, with fonts for every writing system inside, for servers without internet access (138 MB).

Both run on amd64 and arm64.

⁠Marqius Kern: the Gotenberg-compatible PDF server

Keep your Gotenberg code. Change one line. Marqius Kern turns HTML pages, web addresses, Markdown, Word, Excel and PowerPoint files into PDFs, and merges, splits and stamps PDFs. It answers Gotenberg's API, 8.x and 9.x, on one server. Your client library, your compose file and your Paperless-ngx setup stay exactly as they are.

Tested with Gotenberg's own test suites (8.40.0 and 9.10.3) and the tests of 12 client libraries and apps: Python, PHP (Laravel), .NET, Go, Kotlin, Java (Spring), Rust, Swift, Paperless-ngx, solidtime, InvoiceShelf and Haystack. Every result is public, differences included.

⁠What it does for your business
Smaller and quickerReady in 0.14 seconds. 16× smaller: a 41 MB image instead of 665 MB. 40× quicker: the first PDF in 9 milliseconds instead of 367. 15× less memory: 9 MB instead of 144 MB.
Your code keeps workingThe same routes, form fields, defaults and answers as Gotenberg 8.40.0 and 9.10.3. Nothing to rewrite.
Gotenberg 8 stays maintainedGotenberg 8 gets no more fixes. Marqius Kern answers 8.x requests, maintained, and 9.x requests beside them.
Nothing to babysitNo Chromium and no LibreOffice inside: one program. Nothing is left running between documents.
Emails into PDFsEmails (.eml, .msg) and whole mailboxes (.mbox, .pst, .ost) become archival PDFs that keep their attachments, in one call: a route of Marqius Kern's own.
Proof in publicGotenberg's own tests and the client libraries' tests, run against both servers: the scoreboard⁠.

⁠Switch in one line

Change the image in your compose file, Kubernetes manifest or docker run line:

- image: gotenberg/gotenberg:8
+ image: marqius/kern

Everything else stays: port 3000, the gotenberg command with its flags and variables, GET /health (curl is inside for health checks), the user gotenberg (uid 1001), and your client library's settings.

⁠Make a first PDF

Start the server, and wait until it answers:

docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health

A web page to PDF:

echo '<h1>Invoice 1001</h1><p>Thank you for your order.</p>' | curl -sS --fail -F 'files=@-;filename=index.html' -o invoice.pdf http://localhost:3000/forms/chromium/convert/html

A spreadsheet to PDF (any of .docx, .xlsx, .pptx, .csv and the other Office files goes the same way):

printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' | curl -sS --fail -F 'files=@-;filename=prices.csv' -o prices.pdf http://localhost:3000/forms/libreoffice/convert

Merge the two, with the 8.x route and with the 9.x route, on the same server:

curl -sS --fail -F [email protected] -F [email protected] -o merged.pdf http://localhost:3000/forms/pdfengines/merge
curl -sS --fail -F [email protected] -F [email protected] -o merged-9.pdf http://localhost:3000/forms/pdf/merge

An email to PDF, with Marqius Kern's own route. The PDF keeps the message and its attachments together:

printf 'From: Ada <[email protected]>\nTo: Bob <[email protected]>\nSubject: Order 1001\nDate: Mon, 30 Nov 2026 10:00:00 +0000\nContent-Type: text/plain; charset=utf-8\n\nThank you for your order.\n' | curl -sS --fail -F 'files=@-;filename=order.eml' -o order-email.pdf http://localhost:3000/forms/kern/convert/email

Stop it:

docker stop kern

⁠Questions

⁠Which Gotenberg versions does it answer?

Gotenberg 8.40.0 and 9.10.3, both at once: each request is answered in the version its routes and fields belong to. GET /version says 8.40.0, and a request that names neither version is answered as Gotenberg 8 answers it. If your code was written for Gotenberg 9, set one variable: Marqius Kern then reports 9.10.3 (which the .NET client 4 reads to choose its requests) and answers such requests as Gotenberg 9 does:

docker run --rm -d --name kern -p 3000:3000 -e KERN_GOTENBERG_VERSION=9.10.3 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/version
docker stop kern
⁠Do my Gotenberg flags still work?

Yes. The command is gotenberg, and every flag of Gotenberg 8.40.0 is read, on the command line or as a variable (--api-timeout=60s or API_TIMEOUT=60s). Flags that only tune Chromium or LibreOffice are accepted, and the start-up log says they have no effect. A flag asking for something Marqius Kern does not do stops it at start, with the reason.

docker run --rm -d --name kern -p 3000:3000 marqius/kern gotenberg --api-timeout=60s --chromium-disable-javascript=true
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health
docker stop kern
⁠Which languages does it print?

Every language. Arabic and Hebrew, read from the right, are built into the program. For Chinese, Japanese, Korean, Thai, emoji and other writing systems, the first page that needs them fetches the open Noto font once (Japanese is about 10 MB) and prints it; nothing of your document leaves the server. With no internet access, use the fonts tag, which carries them all:

docker run --rm -d --name kern -p 3000:3000 marqius/kern:fonts
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health
echo '<meta charset="utf-8"><h1>請求書</h1><p>ご注文ありがとうございます。</p>' | curl -sS --fail -F 'files=@-;filename=index.html' -o invoice-ja.pdf http://localhost:3000/forms/chromium/convert/html
docker stop kern

To keep fetched fonts when the container is replaced, mount a volume at /tmp/marqius-kern-fonts:

docker run --rm -d --name kern -p 3000:3000 -v marqius-kern-fonts:/tmp/marqius-kern-fonts marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health
docker stop kern
⁠Does it run read-only, without root, on Kubernetes and OpenShift?

Yes. It runs as uid 1001 (in group root, for OpenShift's random uids) and with a read-only root filesystem, given /tmp in memory:

docker run --rm -d --name kern -p 3000:3000 --read-only --tmpfs /tmp marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health
docker stop kern

On docker stop or a Kubernetes rollout, requests in progress finish and new ones are refused, within Gotenberg's 30 seconds (--gotenberg-graceful-shutdown-duration).

⁠How do I use it with Docker Compose?

The service keeps its name, so the address your app calls (http://gotenberg:3000) stays the same:

cat > compose.yaml <<'EOF'
services:
  gotenberg:
    image: marqius/kern
    ports:
      - "3000:3000"
EOF
docker compose up -d
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/health
docker compose down
⁠What does it not do?
  • Pages that need a real browser: canvas drawing, charts that measure the page while they draw, and pages built from fetch requests print without those parts.
  • LibreOffice's rarer formats: Word (.docx, .doc), Excel (.xlsx, .xls), PowerPoint (.pptx), CSV, RTF, OpenDocument and plain text are read. Old PowerPoint .ppt, Visio, WordPerfect and the other rarer formats are refused, with the reason.

Where you need those, keep Gotenberg beside Marqius Kern and send those requests to it.

⁠Should I block internal addresses?

If your server converts pages or files that other people send, yes: set Gotenberg's own switch CHROMIUM_DENY_PRIVATE_IPS=true. Every page and file the server then fetches, redirects included, is refused when it is on an internal or cloud metadata address. It is off by default, as in Gotenberg.

⁠Licence

Marqius Kern has two licences.

  • Personal, teaching and open-source use is free with a Community licence: get your free key⁠.
  • Anything done by or for a business needs a commercial licence. See the plans⁠.
  • To use a licence, set the variable MARQIUS_LICENCE to the licence, or to the path of a file that holds it.

Tag summary

Content type

Image

Digest

sha256:2aec4b451…

Size

41.1 MB

Last updated

about 23 hours ago

docker pull marqius/kern