[nu-demo] At-click-time libreoffice PDF preview for Office docs (companion to home#174) #178
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?
Demo workaround for Office viewing — at-click-time PDF generation
Companion path to home#174.
home#174 tracks the canonical full-fidelity OnlyOffice Document Server install
(real interactive editor, ~3 GB Docker image, ~6 GB runtime RAM, JWT signing,
hero_router routing, save callbacks). That's the right answer for prod editing.
But for read-only demo viewing of
.docx/.xlsx/.pptx, OnlyOffice isoverkill — and the PDF-companion short-circuit shipped on 2026-04-24 (see
home#174 comment) already proves the embed path works. What's missing is an
automatic, server-side generation of those companion PDFs.
Proposal
Add a
pdf_previewroute tohero_office_server(or_ui) that:(context, filename).${stem}.pdfin the same context.${stem}.pdf(and into a server-sidecache for fast re-serve).
Content-Type: application/pdf,Content-Disposition: inline). Browser PDF viewer renders.hero_office_ui::editor_pagealready has a short-circuit for.pdfand acompanion-PDF lookup for non-PDF types. The change is to make that lookup
trigger generation rather than fall through to OnlyOffice.
Why this is the right tradeoff for now
always-on RAM, only invoked on click.
.pptxslides /.xlsxtables/
.docxformatting — not a markdown re-render. (This was the gap noticedon herodemo: pandoc → PDF previews looked like docs, not slides.)
fallback for read-only views; OnlyOffice handles editing.
UserInstallationprofile.Tasks
hero_skills/install/— addlibreoffice-core libreoffice-impress libreoffice-writer libreoffice-calcto apt deps in the bootstrap (ora new
install_libreoffice.nu).hero_office_server— addpdf_preview(context, filename)JSON-RPCmethod that runs libreoffice headless + caches.
hero_office_ui::editor_page— when.docx/.xlsx/.pptxand nocompanion exists, call
pdf_preview(which generates) instead offalling through to OnlyOffice.
LO_CONVERT_TIMEOUT_MSenv (default 30s) and queue/lock somultiple concurrent clicks for the same file don't race.
HERO_OFFICE_PDF_PREVIEW=1(default on) to enable..pptx→ click → renders within 5s on first request,<500ms on subsequent.
Demo-time hotfix already applied
On herodemo (2026-04-24): libreoffice installed, batch-regenerated companion
PDFs from actual
.pptx/.xlsx/.docxfiles. Companion-PDF short-circuitalready in
hero_office_ui(home#174 comment). End-user click renders realslides/sheets via the browser PDF viewer.
This issue is the prod path — auto-generation on the server, no batch step,
no manual regeneration when files are uploaded.
Related
Signed-off-by: mik-tf
Resolved by
lhumina_code/hero_skills@7c823d1(PR lhumina_code/hero_skills#126).Part of Phase 2 tracker #185.