Commit Graph

1 Commits

Author SHA1 Message Date
Darko Gjorgjijoski
35a248b48b fix(pdf): send the installed fonts to Gotenberg (#733)
FontService writes absolute host paths into the @font-face rules:

    src: url("/var/www/html/storage/fonts/NotoSansSC-Regular.ttf")

dompdf shares that filesystem so they resolve. Chromium runs inside the Gotenberg
container and cannot see any of it, so every installed font package silently
failed to load and documents fell back to whatever fonts that image happens to
ship. The docs recommend Gotenberg specifically for mixed-script documents, which
made this exactly the wrong way round -- it worked only by accident, because
Chromium's own font set covers more than dompdf's single-font behaviour.

The font files now travel with the document as Gotenberg assets, and the rules
are rewritten to name them. Gotenberg unpacks assets next to index.html, so a
bare filename resolves.

Only fonts the markup actually references are sent. A CJK package is several
megabytes and has no business riding along on a request that never mentions it.

Confirmed against a stock gotenberg:8, reading the fonts back out of the
rendered PDF:

    before   AAAAAA+LiberationSerif      (Gotenberg's fallback)
    after    AAAAAA+NotoSans-Regular     (the app's own font)

Claude-Session: https://claude.ai/code/session_01QmECndmNZwzN65Zz9P87dF
2026-08-01 14:41:35 +02:00