feat(renderer): render extraction output as PDF
Author: GoldziherCreated Sep 28, 2026Updated Sep 29, 2026
LabelsenhancementP2
Context
Requested alongside external-findings redaction: return the (redacted) document as .pdf.
Current state
- No built-in PDF renderer;
OutputFormathas noPdfvariant. xberg-native-pdfcan destructively redact existing PDFs (region-based,redact_content_stream), but that operates on PDF input geometry, not on redacted extraction output.- Rendering extracted content to a fresh PDF needs a writer (headless HTML→PDF,
printpdf,typst, …); none is a current dependency.
Scope — two distinct features
- Render extracted/redacted content to a fresh PDF. Paginated text/table output, unrelated to source layout.
- In-place destructive redaction of an input PDF. Partly exists in
xberg-native-pdf; the gap is mapping text-level redaction findings (label + text) onto page regions via the OCR/geometry layer.
Proposal
- Add
OutputFormat::Pdf+ built-in renderer for (1), reusing the HTML renderer if a headless path is acceptable, otherwise a native writer. - Track (2) separately if needed; note existing
redact_content_stream,RegionSet,RedactionOptions.
Acceptance criteria
-
--content-format pdfemits a valid PDF. - Text is selectable (not rasterized) unless explicitly configured otherwise.
- Redaction findings are absent from the emitted PDF.
Source: xberg-io/xberg