Decision: first-page rendering pipeline for pane v2 — pdf.js vs server raster, and Gotenberg's future #629
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pane v2 (unified details pane, mockup
pane-v2-unified-mockup.html) needs a PDF's first page as pixels. This issue is the decision record for HOW, and for what it means for Gotenberg. Decision pending Nikola.The two-step truth that frames everything
First-page rendering is two separate problems, and no single option solves both:
/api/v1/preview/pdf, #297).So neither A nor B removes the need for a LibreOffice-engine service for office previews. What CAN change is which service (see "Gotenberg's future" below).
Option A — pdf.js in the client
Vendor Mozilla pdf.js (~1.5 MB, lazy-loaded static asset, separate file so index.html stays single-file). The client fetches the PDF (raw, or Gotenberg's conversion) and renders page 1 to a canvas in the hero; the page box gives the orientation.
Option B — server-side raster (PDF → PNG endpoint)
Three sub-flavours, with very different price tags:
gcr.io/distroless/static, cross-compile pain for arm64).B's genuine advantages over A: rendered once and cached for ALL users (A renders per client); tiny payloads to slow clients; works for exotic clients with no JS canvas. None of these bite at our scale, and the cache is a new state surface (#138 world) we'd have to design.
Gotenberg's future (the "save space" question)
Gotenberg exists ONLY for step 1 (office→PDF). Two honest observations:
convert-toendpoint (docx→pdf, even →png) backed by the same LibreOffice core. Teaching our converter client a second driver ("Collabora convert-to" next to "Gotenberg") is a small, self-contained change — then a Collabora-equipped deployment needs no Gotenberg at all, andoffice.url+preview.converterUrlcan point at one service. That IS the deployment-size win, and it is orthogonal to A/B.So the recommended endgame: A + converter grows a Collabora
convert-todriver as a follow-up — customers choose zero converters (PDF/image/text heroes only), Collabora only (editing + office heroes, one service), or Gotenberg (office heroes without an editor). Cairn itself never grows a PDF parser or a licensing bill.Recommendation
A (pdf.js), with B2 (pdfium/wazero) as the recorded fallback if client-side rendering ever proves inadequate in the beta (e.g. low-power clients, huge non-linearized PDFs beyond the size cutoff mattering in practice). B1 (MuPDF/AGPL) is ruled out on licensing unless we deliberately choose to pay Artifex. The Collabora convert-to driver is filed as its own follow-up either way.
Deciding this closes the last open point on the pane-v2 mockup; slices 1–3 build after.
Decided by Nikola (2026-09-20): A — pdf.js in the client, with B2 (pdfium via wazero) as the recorded fallback. B1 (MuPDF/AGPL) ruled out on licensing. Adequacy is testable, not assumed: #630 carries the beta test cases whose structural failure would reopen this and activate B2. The Gotenberg-reduction half is filed as #631 (Collabora convert-to driver). Pane v2 slice 1 builds on this decision. Closing as decided.