Skip to content

feat: add in-app PDF preview - #202

Merged
nextestudios merged 1 commit into
mainfrom
feature/59-pdf-preview
Sep 27, 2026
Merged

nextestudios merged 1 commit into
mainfrom
feature/59-pdf-preview

Conversation

@nextestudios

Copy link
Copy Markdown
Owner

Summary

  • South on a .pdf (or North → Visualizar PDF) opens an in-app PDF preview. LB/RB and Left/Right change pages (only the available direction is prompted), RT/LT zoom, D-pad pans while zoomed, South fits, East/B closes with focus back on the file. Header shows "página N de M" and the zoom. Prompt fading from enhancement: make image preview controller shortcuts more visible #171 applies here too (shared ZoomablePreviewModal base for image and PDF).
  • Rendering: new ControlFS.Infrastructure.Media project (net10.0-windows10.0.19041.0, no packages) with WindowsPdfRenderer: Windows.Data.Pdf renders one page at a time to BGRA pixels on the thread pool; pixels only (no links, attachments, forms, scripts; nothing handed to another program). The file stays open shared (read/write/delete) and is closed after an in-flight render when the preview closes.
  • Limits / security (PdfPreviewPolicy, PreviewLimits): %PDF- signature within the first 1 KB (a renamed executable never reaches the renderer), 200 MB, 5,000 browsable pages, pages rendered at max 3072 px, 20 s timeout for open/render (a hanging PDF becomes an error). Notes in docs/security-model.md.
  • Password-protected PDFs: clear message, South opens the masked keyboard (no suggestions, password never stored), wrong password → "Senha incorreta." and retry.
  • Render harness: new mp-pdf-preview capture rendering page 2 of a generated A4 PDF with the real renderer.
  • ControlFS.WindowsIntegrationTests now targets net10.0-windows10.0.19041.0 so it can exercise WinRT APIs (lock file updated).

Tested in CI

  • PdfPreviewJourneyTests (fake renderer): paging/bounds/zoom/pan/close releases the document; a renamed executable is refused before the renderer; password flow with wrong + right password on the masked keyboard; a hanging renderer becomes an error within the time limit.
  • PdfRendererIntegrationTests (real Windows.Data.Pdf): renders page 1 of a generated two-page PDF with the right size and pixels, page 2 in portrait, and the file can be deleted after dispose.

Manual checks (docs/TESTING.md, "Visualização de PDF (#59)")

  • Real multi-page PDFs at 1080p/4K and TV distance, real password-protected PDF, PDFs with links/attachments, very large PDFs, file not locked while previewed.

Closes #59

🤖 Generated with Claude Code

Render PDF pages with Windows.Data.Pdf off the UI thread in a new
Infrastructure.Media project: one page at a time, pixels only, with a
content signature check, size/page/render-size limits and a timeout.
Pages and zoom follow the image preview controls; password-protected
PDFs ask on the masked on-screen keyboard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nextestudios
nextestudios merged commit 0ff48ce into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/59-pdf-preview branch September 27, 2026 22:24
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.

feat: add in-app PDF preview

1 participant