Skip to content

feat(export): add PDF report generator and --format pdf option - #471

Merged
kaifcodec merged 9 commits into
mainfrom
feature/pdf-export-report
Aug 1, 2026
Merged

feat(export): add PDF report generator and --format pdf option#471
kaifcodec merged 9 commits into
mainfrom
feature/pdf-export-report

Conversation

@kaifcodec

@kaifcodec kaifcodec commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Description

Adds a PDF report generator feature to user-scanner.

Key Changes

  • PDF Generator Module (user_scanner/core/pdf_generator.py): Built with ReportLab, Pillow, and Svglib. Generates an Intelligence Dossier containing header details with tool version, target summary box, identified profile media grid (60x60 square cropped avatars), digital footprint mapping table, and extracted deep intelligence cards with proper vertical leading to prevent text overlap.
  • Formatter Helper (user_scanner/core/formatter.py): Added into_pdf wrapper function.
  • CLI Export Support (user_scanner/__main__.py): Updated -f / --format choices to accept pdf, auto-detected .pdf file extensions, and added --no-pdf-media flag option to skip avatar downloads if needed.
  • Optional Dependencies (pyproject.toml): Defined pdf = ["reportlab>=4.0.0", "pillow>=10.0.0", "svglib>=1.5.0"].
  • Unit Tests (tests/test_pdf_generator.py): Comprehensive test suite covering PDF generation, magic byte verification, header version display, and missing dependency fallbacks.
@kaifcodec kaifcodec added the enhancement New feature, request, code improvements/upgrade, performance boost label Jul 27, 2026
@kristoisberg

kristoisberg commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

When testing the snapcode question I noticed some issues with link rendering:
user-scanner -f pdf -u asdfg -m snapchat

Checking username: asdfg
[✔] Snapchat (asdfg): Found
└── snapcode: https://app.snapchat.com/web/deeplink/snapcode?username=asdfg&type=SVG&bitmoji=enable

But it is rendered in the report as follows:
image

Only the first line is clickable, and some characters are added that shouldn't be there.

Looks great otherwise!

Comment thread user_scanner/core/pdf_generator.py Outdated
@kaifcodec

Copy link
Copy Markdown
Owner Author

@kristoisberg The issue happened because ReportLab’s Paragraph component parses text input as HTML/XML. When a URL contains unescaped ampersands (&), ReportLab mistakes them for XML entities and automatically injects semicolons, turning &type into &type;= and breaking the link.

Wrapping the raw URL strings with html.escape() before passing them to Paragraph ensures & is properly handled as &, keeping the URL intact without any unwanted semicolons.

I pushed the fix in (31e9326).

Comment thread user_scanner/core/pdf_generator.py
Comment thread user_scanner/core/pdf_generator.py Outdated
@kaifcodec
kaifcodec requested a review from VamatoHD July 30, 2026 03:01

@VamatoHD VamatoHD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kaifcodec
kaifcodec merged commit 82bd065 into main Aug 1, 2026
5 checks passed
@kaifcodec
kaifcodec deleted the feature/pdf-export-report branch August 2, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, request, code improvements/upgrade, performance boost

3 participants