How pdf.js is put together
PDF.js is Mozilla's HTML5/JavaScript PDF renderer and viewer. The codebase is split into a parsing/rendering engine under src/ (core PDF interpreter running in a Web Worker via src/pdf.worker.js, display-layer API in src/display/api.js, shared utilities), a full-featured browser viewer UI under web/ (PDFViewerApplication orchestrating toolbar, sidebar, annotation editors, find, scripting), and a Chrome extension under extensions/chromium/. Data flows from fetched/binary PDF bytes through the worker-thread parser to canvas/text/annotation layers rendered by the main-thread viewer. Everything is built with Gulp + Webpack + Babel into generic, legacy, Firefox (MOZCENTRAL), and Chromium bundles.
Languages
Frameworks
Infrastructure
Major components
src/core (PDF interpreter)
Worker-side parsing of PDF structures: xref, objects, fonts, colorspaces, evaluator of content streams, default appearance/appearance-stream evaluation (e.g. src/core/default_appearance.js).
src/display (public API)
Main-thread API (getDocument, PDFDocumentProxy, PDFPageProxy, rendering, text layer, XFA text, transport streams) that communicates with the worker over MessageHandler ports.
src/shared
Cross-environment utilities shared by main thread and worker, including message_handler.js for structured postMessage RPC.
web/ viewer application
The complete HTML5 viewer UI: app.js (PDFViewerApplication) wires together toolbar, thumbnail/outline/attachment viewers, find bar, print service, password prompt, preferences, download manager, and annotation editors.
Annotation & form editing layer
Annotation editor layer builders, signature manager, alt-text managers, comment manager, digital-signature properties, and undo bar for user-added annotations.
Scripting/sandbox subsystem
PDF JavaScript execution support via src/pdf.sandbox.js, src/pdf.scripting.js, src/pdf.sandbox.external.js and web/pdf_scripting_manager.js.
extensions/chromium
Chrome extension that intercepts PDF navigations (extension-router.js service-worker fetch handler, pdfHandler.js, background.js) and redirects them to the bundled viewer.
Build/test tooling
gulpfile.mjs drives bundling (generic/generic-legacy/chromium/dist), linting (ESLint, Stylelint, svglint), and Jasmine/Puppeteer-based unit, integration, and reference tests with optional Istanbul coverage.
A week of internal cleanup and small fixes, including steadier touch zooming and better vertical alignment of text in form fields.
3 weeksWeek of 2026-08-17
Week of 2026-08-17latest
A week of internal cleanup and small fixes, including steadier touch zooming and better vertical alignment of text in form fields.
Week of 2026-08-10
The viewer got a major visual overhaul to the new 'Nova' design, plus large-JPEG performance gains and right-to-left layout fixes.
Week of 2024-05-20
A single targeted fix landed this week, closing out unfinished marked-content sections in text objects.
The last few weeks of pdf.js development focused on polishing the viewer experience and cleaning up internals. Highlights include a visual refresh of the viewer to the new 'Nova' design, smoother touch behavior on tablets, better handling of right-to-left languages, and faster JPEG image rendering. Alongside these user-facing improvements, contributors did steady housekeeping—removing unused code, caching text decoders for speed, updating dependencies, and fixing flaky automated tests.
Week by week
2026-08-17A week of internal cleanup and small fixes, including steadier touch zooming and better vertical alignment of text in form fields.latest6 changes
Fix
No accidental zoom while panning
Fast two-finger panning no longer triggers unwanted pinch-to-zoom on touch devices.
Fix
Text centered in form fields
Single-line and comb-style form fields now vertically center their text as expected (bug 2055455).
Refactor
Faster font data processing
Reused text encoder/decoder objects are now cached when compiling and decompiling font data, avoiding repeated setup work.
Refactor
Simplified page label handling
The code that handles letter-based page labels (like /A and /a) was shortened and made more consistent.
Chore
Removed unused JPEG decoding option
Dead code for an unused /Decode setting was removed from the JPEG image classes.
Chore
Updated translations
Locale files were refreshed with the latest community translations.
2026-08-10The viewer got a major visual overhaul to the new 'Nova' design, plus large-JPEG performance gains and right-to-left layout fixes.6 changes
Feature
Nova design refresh
The PDF viewer's interface was updated to Mozilla's new 'Nova' visual style (bug 2063405).
Refactor
Downscaled large JPEGs
Very large JPEG images are now shrunk during decoding using the browser's ImageDecoder, making them render faster and use less memory (bug 2063570).
Fix
Right-to-left language fixes
The floating toolbar and views manager header now display correctly in right-to-left locales like Arabic and Hebrew.
Refactor
Highlight editor rework
The highlight annotation editor was restructured to build on the shared drawing-editor foundation.
Feature
Firefox release tooling
A new automated task was added for releasing pdf.js into the Firefox source tree.
Chore
Dependency updates
Project dependencies were upgraded to their latest versions, including security fixes in third-party libraries.
2024-05-20A single targeted fix landed this week, closing out unfinished marked-content sections in text objects.1 change
Fix
Closed unclosed content sections
Marked-content sections left open inside a text object are now automatically closed, fixing a rendering edge case (bug 1898053).
Dependencies and code review
Dependency advisories
Security Watch
No known advisories across 831 scanned dependencies.
No known advisories in the scanned dependencies.
Code review
No concrete code-level issues confirmed.
Get this report every week for your repos.
GitZoid learns each repo, reports what changed, and flags what needs attention. One flat price for the whole team.
$19 a month, flat · First 10 outputs free · No card required