All updates
ProductionQAFrontend

PDF Preview Fix: Reliable In-Browser Document Viewing

PR #625pixbox-supportOct 21, 2025 · 15:34 UTC
QAOct 21, 2025
ProductionOct 21, 2025

Executive summary

This change fixes intermittent blank screens when previewing PDF documents in the browser. The viewer now loads document files directly instead of routing them through the Google Docs preview service, restoring dependable in-app PDF viewing. (Reached QA.)

Why this was needed

The PDF preview was rendered by embedding documents through Google's external viewer (docs.google.com/gview). That approach was unreliable and frequently displayed a blank screen instead of the document, leaving users unable to view PDFs. This regression needed to be corrected so document previews load consistently.

Client / user impact

Users opening a PDF preview should now see the document reliably rather than an empty viewer. Because the file is loaded directly rather than via a third-party Google viewer, the document content no longer leaves the application's signed-URL flow for rendering, and the preview stays clean (no extra third-party viewer chrome).

Technical scope

  • Single file changed: src/components/common/pdf-viewer/PDFViewerCore.tsx (+27 / -6); merge of feature PR #623 (codex/revert-to-iframe).
  • Reverted the iframe source from the Google Docs embedded viewer (https://docs.google.com/gview?embedded=true&url=...) back to the direct file URL.
  • Retained existing URL normalization: for Filestack / AWS (amazonaws, AWSAccessKeyId) signed URLs, response-content-disposition=inline is set so the file renders inline instead of downloading; malformed URLs fall back to the raw value.
  • Code-quality touch-ups: extracted constants (DEFAULT_IFRAME_TITLE, BASE_IFRAME_CLASSNAME, IFRAME_ALLOW_FEATURES) and added a JSDoc component description. No change to the fullscreen allow attribute or accessibility title behavior.

Risk & mitigation

Low risk and narrowly scoped to one presentational component. The main consideration is that direct iframe rendering relies on the browser's native PDF handling and on signed URLs serving content inline; some browsers/configurations may handle inline PDFs differently than the prior Google-viewer path. Mitigation: the inline response-content-disposition handling for cloud-storage URLs is preserved, and the change is a revert to a previously known-working approach.

QA validation focus

  • Open PDF previews across the surfaces that use the viewer (e.g., document/mail detail) and confirm the document renders, not a blank screen.
  • Verify previews work for Filestack and AWS S3 signed URLs (files display inline, do not auto-download).
  • Test in major browsers (Chrome, Firefox, Safari, Edge) given reliance on native iframe PDF rendering.
  • Confirm the viewer fills its container (full width/height, no border) and that fullscreen still works.