Repository navigation
feat(pdf-viewer): view, annotate and edit PDFs based on PDF.js - #4614
Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 2 medium |
| ErrorProne | 1 high (1 false positive) |
| CodeStyle | 17 minor |
| Complexity | 1 medium 5 minor |
🟢 Metrics 2183 complexity · 10 duplication
Metric Results Complexity 2183 Duplication 10
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
6d53069 to
5d53edd
Compare
1e78fa6 to
ebaa9ab
Compare
|
Why we stay on the legacy PDF.js build: I tried switching to the modern build. The legacy build is the exact same code plus a core-js polyfill block in front, nothing else differs. Without those polyfills, the modern build calls brand new builtins unguarded:
So with the modern build a Chrome from before February 2026 couldn't open PDFs at all, and one from before April couldn't save. The legacy build only needs Chrome 119 / Firefox 121 / Safari 17.4. Doing our own polyfills on top of the modern build would just rebuild the legacy build, and we'd have to track new builtins on every PDF.js update, so the legacy build it is. |
|
That's quite the feature set, nice. I haven't looked at the code too close yet, but 2 things I noticed:
|
|
They are kept now until the app is closed, opting out for user setting strategy for later |
c149031 to
b3faabf
Compare
Replace the PDF viewer with a viewer and editor built on PDF.js (pdfjs-dist, legacy build), keeping its name and icon. - View: thumbnails, outline, attachments, layers, find, page labels, zoom, rotation, scroll and spread modes, presentation mode, document properties, print and download, the keyboard shortcuts of the PDF.js viewer - Edit: forms, text, highlights, drawings, images, signatures and comments, with undo/redo; delete and move pages - Save through AppWrapper's flush hook, the PDF is only written on save - PDF.js assets are copied to pdfjs/<version>/, its CSS is scoped to the viewer - No form scripts and no WebAssembly, attachments are always downloaded, signatures only from raster images Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
5fad0ab to
a64c0de
Compare
Viewers can fill in form fields, so they can print a filled form. Nothing gets saved and nothing else changes for them. Escape in a form field no longer closes the app, so what was filled in is not lost. Assisted-by: Claude Code:claude-opus-5-5
Description
The PDF viewer now uses PDF.js instead of the browser's built-in PDF view. This is the PDF Studio app from web-extensions, moved into core instead of shipping as an extension. Name, app id and icon of the PDF viewer stay the same.
What you get on top of plain viewing:
Things worth knowing:
Promise.withResolvers(Chrome 119, Firefox 121, Safari 17.4). Older browsers from our browserslist (roughly 2.7%, e.g. iOS 15.6 to 17.3) can't open PDFs anymore, where the old native view worked. We decided to accept that for now. @kulmann, your call if you see it differently.Related Issue
How Has This Been Tested?
pdfjs/<version>/Types of changes