#1943·xberg

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; OutputFormat has no Pdf variant.
  • xberg-native-pdf can 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

  1. Render extracted/redacted content to a fresh PDF. Paginated text/table output, unrelated to source layout.
  2. 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 pdf emits a valid PDF.
  • Text is selectable (not rasterized) unless explicitly configured otherwise.
  • Redaction findings are absent from the emitted PDF.