Skip to content

feat: standalone vectorized PDF dossier report export and viewer endpoints - #2713

Merged
Datalux merged 2 commits into
Datalux:developmentfrom
SuperJaba:feat/dossier-pdf-export
Oct 29, 2026
Merged

Datalux merged 2 commits into
Datalux:developmentfrom
SuperJaba:feat/dossier-pdf-export

Conversation

@SuperJaba

Copy link
Copy Markdown

Summary

This PR introduces a standalone, zero-dependency PDF generator and export pipeline for investigation dossiers in Osintgram.

Key Capabilities

  • Pure Python PDF Generator (src/pdf_report.py):
    • Implements a self-contained PDF 1.4 document builder with automatic multi-page flow.
    • Zero external C-dependencies (no Cairo, Pango, or wkhtmltopdf required); runs in all lightweight Python environments and CI pipelines out of the box.
    • Generates publication-ready intelligence dossiers featuring:
      • Target Profile summary, privacy/verification badges, and key metric tiles.
      • Formatted tables with zebra striping for followers, followings, key commenters, geotagged addresses, and hashtags.
      • Confidentiality banners, running headers, and running footers with automated pagination (Page X of Y).
  • REST Endpoints:
    • GET /api/dossier/{target}/{dossier_id}/pdf: Direct download of saved dossiers as formatted PDF documents.
    • POST /api/export/pdf: Instant export of current live search results to PDF.
  • Web UI Integration:
    • Report (PDF) action in the File menu.
    • Direct PDF download button in the Saved Dossiers table rows.
  • Test Coverage:
    • Comprehensive unit and API endpoint tests in tests/test_pdf_report.py (100% pass).
    • Documentation updated in doc/web-ui.md.

SuperJaba and others added 2 commits October 28, 2026 17:37
- Declare /Encoding /WinAnsiEncoding on the four fonts and encode the page
  streams as cp1252. Without it viewers use StandardEncoding and draw
  accented letters as the wrong glyph (é as Ø, è as Ł, ñ as æ).
- Reduce text to what WinAnsi can show: accents it lacks fall back to the
  base letter (ś -> s, ł -> l), other scripts and emoji become one "?" per
  run, and zero-width characters are dropped.
- Wrap long values (e.g. a biography) over up to 6 lines instead of cutting
  them at 85 characters, and truncate table cells by measured width.
- Truncate before escaping: cutting an escaped string could leave a lone
  backslash that swallowed the closing parenthesis.
- Ignore non-object items and out-of-range timestamps in the dossier data,
  and validate POST /api/export/pdf (422 for non-object cards/results, 400
  for an invalid saved_at) instead of returning a 500.
- Document the font limits in doc/web-ui.md; add tests for all of the above.
@Datalux
Datalux force-pushed the feat/dossier-pdf-export branch from 914e074 to 07216c1 Compare October 29, 2026 15:19
@Datalux
Datalux merged commit 194f9c9 into Datalux:development Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants