mrkeyoor.comAsk

mozilla/pdf.jstested 25 Oct 2026commit e2a5e1d

pdf.js review

Use PDF.js when your team needs control over PDF viewing and can own worker delivery, interface behavior and document regression checks.

  • README snippet failed
  • 1.3 MB on disk
12 sto install
  • 1 dependency
Webevaluationupdated 21 Nov 2026
+30stars / 7d

PDF.js is Mozilla's open-source JavaScript library and viewer for parsing and rendering PDFs. You can adapt its ready-made viewer or use the display API inside your own interface.

Verdict

Use PDF.js when your team needs control over PDF viewing and can own worker delivery, interface behavior and document regression checks. Our source install succeeded in 12 seconds; the later quickstart stopped at its snippet check after selecting another npm package. Teams needing a finished existing-text editor or certificate-validation workflow should evaluate products against those requirements before choosing their viewer. Start application integration from Mozilla's pdfjs-dist distribution.

PDF.js infographic: render PDFs inside your own interface, plus its uses, our test result, pitfalls and who it suits
Tested 21 November 2026: the README snippet failed. Before that: 25 Oct: source install 12 s; npm install took 2.3 s.

We ran it

Lab card: what happened when we ran pdf.js
Lab card from our sandbox run
Screenshot of pdf.js (mozilla.github.io/pdf.js)
mozilla.github.io/pdf.js
Install✓ · 12s768 packages · 376 MB
Buildn/ano build script
Testsn/ano test script
Known vulns00 critical · 0 high · 0 moderate · 0 low (npm audit)
Repo2636 files~280,972 lines of source · 157.7 MB · 21 CI workflows · tests dir

Answers from our run

Does pdf.js build from source?

Dependencies installed in 12 seconds (768 packages), and the project has no separate build step. We cloned commit e2a5e1d into a clean Debian container with 3 CPUs and no project-specific setup.

Does pdf.js have tests you can run?

Not through a standard command: the project exposes no test script or target that our harness could run.

Does pdf.js have known vulnerabilities in its dependencies?

npm audit found none in the dependency tree at the time of our run.

Who should not use pdf.js?

Teams whose immediate requirement is a finished existing-text editor.

What are the alternatives to pdf.js?

React-PDF, pdf-lib, PDF.js Express. Use PDF.

Setup4/5In our 2026-11-21 run it installed in 2.3 s; the README gave no task we could run as written.Editor’s note: Source dependencies installed, but build and tests were skipped; the later recipe installed pdf.js 0.1.0 and stopped before a PDF task.
Docs4/5The README has an install section (“Getting Started”) and a usage section (“Online demo”); we did not run its quickstart ourselves.Editor’s note: Mozilla documents layers, distributions and Gulp tasks; the recorded work contains no completed integration following those instructions.
Community5/5Last push on 2026-11-21, 54,166 stars and maintainers answered or closed 10 of the 10 most-discussed issues we sampled.Editor’s note: Sampled issues contain maintainer diagnosis and user workarounds, but no measurement of response times or support capacity.
Maturity4/5Latest release v6.5.438 on 2026-11-01 and repository created 2011-04-26.Editor’s note: Firefox integration and release fixes document project history; the recorded runs contain no rendering workload or reliability assessment.

How we score

Discussed on

  1. hnPdf.js: PDF Reader in JavaScript 371 points
  2. hnHow fast is PDF.js?235 points
  3. hnAn even slimmer pdf.js166 points
  4. hnPdf.js reached its first milestone119 points
  5. hnShow HN: PDF annotation /w screenshot exporter using Chrome Headless and PDF.js5 points

Who it’s for

Web developers who need control over PDF viewing and can maintain worker delivery and browser integration.
Teams adapting Mozilla's ready-made viewer or extracting PDF text for further processing.
React developers choosing between the display API and a React component wrapper.

Who it’s NOT for

Teams whose immediate requirement is a finished existing-text editor.
Buyers choosing a document SDK chiefly for certificate-validation workflows.
Applications treating a hidden download button as protection for private files.

Setup reality

Our October 25, 2026 source install at e2a5e1d succeeded in 12 seconds, recording 768 dependencies and 376 MB on disk. Build and tests were skipped because the harness detected no matching script/target. npm audit recorded 0 known vulnerabilities. The configured sandbox had 3 CPUs, 8 GB RAM and image label lab-node:22.

The November 21 quickstart used commit 57dead10694e and selected the npm name pdf.js. It installed pdf.js 0.1.0 in 2.3 seconds, then stopped because the README had no JavaScript/TypeScript snippet to run. Mozilla's README directs application developers to pdfjs-dist.

The 6.5.438 distribution declares build/pdf.mjs as its entry point and Node >=22.13.0 || >=24 as its engine requirement. Mozilla documents a local HTTP server, worker assets and separate source-development Gulp tasks.

PDF.js gives web developers a PDF rendering library and a ready-made viewer. Our source install succeeded in 12 seconds, while a later quickstart selected another npm package and stopped at its snippet check. The adoption decision is how much document behavior your application team will own: worker delivery, viewer controls, extraction output and browser integration. Use PDF.js for control over viewing; evaluate a document SDK when your immediate requirement is a packaged editing or certificate-validation workflow.

What people use pdf.js for

PDF.js's display API renders PDFs and exposes document information; its viewer adds the Firefox PDF interface, according to Mozilla's getting-started guide. The guide separates these layers from the parser underneath them. It recommends the viewer as a starting point for a custom reader and asks developers embedding it to re-skin it or build upon it. That makes the first integration choice concrete: adapt the existing interface, or build your interface around the display layer.

Developers have used PDF.js for application previews, repeated document display and text extraction. These accounts describe different workloads, so they help identify what to exercise in an evaluation:

Mozilla's v6.5.438 release notes describe annotation-editing improvements and fixes for choice fields and initial radio-button selection. Those changes give a more useful feature picture than a blanket description of PDF.js as a canvas renderer with no interactive features. Rendering a page, filling a field, adding an annotation and changing existing text are separate requirements. Keep the fork author's editing experiment attached to that fork when deciding which of these jobs upstream PDF.js should perform.

What happened when we ran it

Our November 21 quickstart installed pdf.js 0.1.0 in 2.3 seconds, then failed because the README had no JavaScript/TypeScript code block to run. The recipe selected the package name mechanically from package.json; Mozilla's README instead names pdfjs-dist for prebuilt application use. The run used commit 57dead10694e in a fresh unprivileged lab-node:22 container configured with 2 CPUs, 4 GB RAM, no published ports and no secrets. Teardown completed successfully.

Question Answer Verdict Why
Did the quickstart clone step complete? The recipe recorded 10 seconds Completed Clone step
Which npm package did the recipe install? npm install pdf.js@latest installed pdf.js 0.1.0 in 2.3 seconds Package selection needs correction Mozilla names pdfjs-dist
How much space did that installation occupy? node_modules occupied 1.3 MB Recorded for pdf.js 0.1.0 Installed-size step
How many additional packages did it record? 1 package besides pdf.js Recorded for that installation Dependency-count step
Did the README snippet step complete? FAILED; no JavaScript/TypeScript code block to run Stopped Snippet failure, no-snippet finding
Did teardown complete? teardown: ok Completed Teardown result

Our October source install succeeded in 12 seconds and recorded 768 dependencies occupying 376 MB. That run used commit e2a5e1d on October 25, 2026, with a configured sandbox of 3 CPUs, 8 GB RAM and image label lab-node:22. These figures describe source dependency setup. They belong to a different checkout and installation route from the November recipe, whose installed package was pdf.js 0.1.0.

Source-repository check Recorded result Interpretation
npm install Succeeded in 12 seconds; 768 dependencies; 376 MB on disk Dependency installation completed
Build No build script/target; skipped Harness skipped the build stage
Tests No tests script/target; skipped Harness skipped the test stage
npm audit 0 known vulnerabilities; 0 critical, high, moderate or low Dependency-audit result for this snapshot
Repository scan 2,636 files; about 280,972 source lines; 157.7 MB checkout Source-checkout measurements
Workflow scan 21 CI workflow files; tests directory present; no Dockerfile Repository structure recorded by the harness

The October measurement records installation success and skipped build and test stages. Mozilla's README documents Gulp tasks for source development, bundles and testing. Its browser unit, Node unit, integration and reference-test commands explain why a repository can contain test infrastructure while a generic harness skips its test stage. The checkout size and installed dependency size describe development storage, rather than the assets a browser downloads.

Where people get stuck: workers, bundlers and browser differences

PDF.js 4.0.189 users reported a top-level-await bundling error in issue #17245. Commenters changed Vite and esbuild targets to es2022, and acbellini confirmed that the configuration fixed their integration. Another commenter reported success with a plugin. The thread also contains a separate error for IIFE output. Keep the exact error, library version and output format together when diagnosing an integration, because those reports concern different build settings.

Symptom and discussion Reported response Status described in the discussion
Top-level await, #17245 Adjust Vite/esbuild targets or use a plugin Commenters reported successful workarounds
Apparent random bolding, #7136 Enable workers; address script caching; use one PDFWorker for repeated document loads Reporter said workers enabled worked 100%
Missing or overlapping characters, #14641 Disable hardware acceleration or change GPU selection Users reported hardware-dependent outcomes
Oversized mathematical formulas, #2594 Maintainers compared Linux environments Ubuntu reporters continued reproducing the problem
Chrome focus test during the BiDi transition, #17961 Try PR 17962 A contributor reported the test passed on that branch; bot OOM crashes also appeared
Historical coverage setup, #8632 Transpile module sources and use the existing webpack route Maintainer diagnosed missing transpilation

Workers execute PDF processing outside the main page's execution context. In oddjobz's worker discussion, the reporter connected the display problem to disabling workers while cycling through small documents. The maintainer recommended a shared PDFWorker for repeated loads, and the reporter later described caching on the live server. Mozilla's getting-started guide also says workers are disabled on file:// URLs and directs readers to use a server.

Current packages need module paths and a deliberate runtime choice

The pdfjs-dist 6.5.438 metadata declares build/pdf.mjs as its entry point and Node >=22.13.0 || >=24 as its engine requirement. Mozilla's current distribution layout lists pdf.mjs and pdf.worker.mjs, plus viewer files, character maps, images and translations. These are JavaScript modules using import and export. An integration copied from an older script-tag tutorial therefore needs its filenames matched to the selected distribution, rather than copied solely because the library name is the same.

The Mozilla README offers two application routes: use a prebuilt distribution or build from source. Source development uses npx gulp server and opens the viewer on port 8888; generic and generic-legacy are documented bundle tasks. For an application, decide which viewer layer you need, arrange worker and resource delivery, and keep the worker aligned with the library release. For PDFs on another domain, Apryse's embedding guide says the PDF host needs CORS configuration.

Signatures need three different acceptance tests

PDF.js Express describes signing with hand-drawn annotations, while the Reddit fork author describes detecting signature-related data. Those are different operations from validating a certificate-based signature. A product requirement that says only "digital signatures" leaves the implementation choice unclear: the application may need a visible mark, information about an existing signature, or a trust decision about the signed document. Give each operation its own acceptance criteria before comparing viewer feature lists.

Requirement Evidence Application decision
Add a visible signature PDF.js Express describes hand-drawn annotations Assess drawing, placement and saved appearance
Detect signature-related data pucyta describes detection in a fork Identify the fork and feature being evaluated
Validate a certificate-based signature Historical issue #1076 discusses support needing implementation Request a demonstration of the required validation behavior

PDF.js Express describes signing with hand-drawn annotations and saving those signatures for multiple pages. Historical issue #1076 contains reports about signature display and discussion of certificate extraction and message digests. The distinction affects what a demonstration must show: placing a signature image answers an appearance question, while a certificate workflow must answer the application's trust question. A successful appearance demonstration should be recorded under the appearance requirement.

Printing and volume need document-specific checks

Evaluate printing and volume on representative documents, recording output quality, loading behavior and the browser and device configuration. In issue #2750, a0preetham reported that increasing print-rendering resolution improved quality while making printing slower. The discussion includes different browser and print-route outcomes. For an application evaluation, record the PDF.js version and print route alongside the document, then compare the physical output with the screen rendering as separate results.

Repeatedly opening small PDFs and scrolling a long drawing set exercise different application behavior. Oddjobz's issue concerns repeated loading and worker-script delivery, so it suggests recording asset reuse as well as page appearance. Historical Internet Explorer issue #3983 reports cropped, overlapping and extra pages, with partial workarounds involving shrink-to-fit, overflow and print-canvas scaling. Mobile zoom issue #2582 discusses browser pinch followed by canvas redraw and reports performance and stability problems.

Security starts with access to the PDF itself

Apryse's embedding guide says users can find the underlying file even when download and print buttons are hidden. Removing a toolbar control changes the interface; authorizing the file request determines access to a private document. If your application serves protected PDFs, include the document endpoint in its access-control design. The same requirement should appear in a viewer demonstration, so reviewers examine the file request as well as the buttons visible on screen.

Our October npm audit recorded 0 known vulnerabilities across all reported severities. Separately, an X author reported CVE-2024-4367 in a vulnerable deployment. Those observations answer different questions: the audit describes the installed dependency snapshot, while the social post describes its author's deployment finding. Keep the audit result tied to the October installation and use an advisory for any decision about affected versions, patches or document-processing security.

PDF.js vs React-PDF, PDF.js Express and Apryse WebViewer

React-PDF supplies React components for displaying existing PDFs; pdf-lib creates and modifies documents. Those alternatives address different application tasks. Commercial viewers add another decision: whether packaged document workflows justify their licence and integration requirements. Choose the task first, then compare products against it. That prevents a component wrapper, a generator and a viewer SDK from being treated as interchangeable rendering engines in a performance table.

Option Reason to evaluate it Work to plan
PDF.js directly Use the display API or adapt Mozilla's viewer Worker delivery, interface behavior and document checks
React-PDF Render existing PDFs with Document and Page components Application controls, styles and matching worker configuration
pdf-lib Create or modify PDF documents Generation logic and a separate display step
PDF.js Express Vendor offers annotations, form filling and hand-drawn signing Evaluate the packaged workflows your application needs
Apryse WebViewer Vendor markets editing, permanent redaction and additional formats Select required features and account for commercial licensing

React-PDF's README says the worker must match its exact pdfjs-dist version and warns that multiple installed versions can select the wrong worker. A wrapper therefore changes the component interface while preserving worker-delivery responsibilities. pdf-lib's README describes creating and modifying files, including forms and page operations. It can complement a viewer when the requested output is a changed document, rather than replace the viewer's display interface.

What the other reviews get wrong

Syncfusion's forms-and-annotations exclusion conflicts with Mozilla's v6.5.438 annotation-editing improvements and form-field fixes. Syncfusion's comparison says there is no native support for forms, annotations or signatures. Apryse's React comparison says developers must build advanced annotation and form tools completely from scratch, while its own table lists five annotation tools out of the box. Correct those blanket exclusions by naming the capability under discussion.

Syncfusion also describes PDF.js as entirely client-side, although Mozilla's README documents Node unit tests and the distribution declares a Node engine requirement. The old andreasgal repository presents Firefox integration as a possibility; Mozilla's current guide identifies the viewer as Firefox's PDF interface. These statements describe different stages or deployment choices, so a current review should use the current project documentation for its description of PDF.js.

Apryse's embedding tutorial illustrates build/pdf.js, while Mozilla's current prebuilt layout names pdf.mjs and pdf.worker.mjs. Foxit's PDF.js: the 2020 Review discusses update frequency using 2019 history; the current release identifies changes since v6.4.299. Finally, a Bilibili search result promises a preview that cannot be downloaded, but Apryse's own embedding guide explains that hiding download controls still exposes the delivered file.

Questions people ask

Mozilla's getting-started page lists stable v6.5.438 for both modern and older-browser downloads. The npm distribution is named pdfjs-dist, and the repository is mozilla/pdf.js. Those names answer the version and package questions behind many first-time integrations. The FAQ below separates distribution selection, custom-viewer behavior, extraction and printing so each answer points to the relevant documentation or attributed report.

What is PDF.js, and how do its library and ready-made viewer differ?

The display layer renders PDFs and exposes document information; the viewer supplies an interface built on that layer. Mozilla's layer guide describes direct parser access as advanced usage and recommends the viewer as a starting point for a custom reader. Adapt that viewer when its interface fits your product, or use the display layer when the application needs its own layout and controls.

What is the latest PDF.js version, and where are its npm package, downloads and GitHub repository?

The official download and npm snapshots identify PDF.js 6.5.438 and the package pdfjs-dist. Mozilla's getting-started page links modern and older-browser distributions, while mozilla/pdf.js contains the source. Use the distribution and documentation for your selected release together. The source checkout has a development workflow of its own, including the local Gulp server and bundle tasks described in the README.

Is PDF.js 3.11.174 still the latest version?

No: Mozilla's getting-started page identifies stable v6.5.438. The 6.5.438 npm metadata uses build/pdf.mjs and declares Node >=22.13.0 || >=24. When an integration guide names 3.11.174, keep its examples associated with that release and compare their paths with the distribution you intend to install. Mozilla's current layout also lists pdf.worker.mjs, viewer.mjs, viewer.css and the supporting viewer-resource directories.

Can PDF.js convert pdf.json or JSON data into a PDF?

PDF.js parses and renders PDFs; pdf-lib's README describes creating and modifying them. The freeCodeCamp tutorial announcement describes rendering with PDF.js, manipulating pixels with Canvas and generating a new PDF with PDF-lib. For a JSON workflow, first identify whether the data contains extracted text, application records or drawing instructions. That determines what the generation step must translate into pages.

How do I build a custom PDF.js viewer with pagination, zoom and loading errors?

The custom-viewer tutorials demonstrate page navigation, rendering scale and missing-file feedback. Create a Custom PDF Viewer With JavaScript shows navigation through a five-page PDF and deliberately changes the file path to display an error. The all-pages viewer tutorial changes rendering scale for zoom. These examples identify interface behaviors to implement around document loading and page rendering.

How do I extract PDF text or table data with PDF.js and save it as JSON?

Tuba Mirza's tutorial maps text-item string properties into an array and discusses saving it as JSON or database data. The presenter says repeated columns depend on how the PDF was structured. That makes the array a useful intermediate output: inspect its order and contents before assigning table-column names or using it as paragraph text. The tutorial's extraction operation and the later storage operation are separate steps.

Where can I find PDF.js documentation and learn how to count a PDF's pages?

Mozilla's README links the API documentation, interactive examples and additional examples in the repository. The pagination tutorial demonstrates a changing page number, and the custom-viewer tutorial uses the document's numPages value for navigation. Start with Mozilla's API documentation and the examples associated with your installed release, then connect page count to your application's navigation controls.

Can I force letter-size, black-and-white printing without letting users change the settings?

A commenter in Pabloquero's Reddit thread proposed generating a separate US Letter grayscale PDF with jsPDF. The proposal renders pages to canvas or SVG, changes the resulting image to grayscale, then builds another PDF at the requested size. That describes transforming the document before printing. It gives a concrete implementation direction for the requested page size and appearance without attributing control of the printer dialog to PDF.js.

Why is PDF.js printing blurry, and how can I improve print quality?

A commenter in issue #2750 reported better print quality and slower printing after increasing rendering resolution. The discussion contains different browser and print-route outcomes, so record the configuration when trying that approach. Compare the generated output with the original document and record the time alongside quality. This preserves both parts of the reported tradeoff instead of presenting resolution as a cost-free adjustment.

Why did PDF.js printing crop or overlap pages in Internet Explorer?

Issue #3983 reports incorrect printing in IE9 through IE11, including overlapping pages and incomplete output. Reporters tried disabling shrink-to-fit, changing overflow rules and removing print-canvas scaling. The thread also describes remaining extra-page and half-page problems. These details explain the historical reports and distinguish the attempted workarounds from a single complete fix across all the Internet Explorer configurations discussed.

Does PDF.js support natural pinch-to-zoom on mobile without blurry output?

Historical issue #2582 describes browser pinch followed by a canvas redraw and reports performance and stability problems. The discussion distinguishes enlarging an existing canvas image from rendering again at a different scale. For a mobile-viewer evaluation, record gesture behavior, the redraw result and the device together. That makes the zoom requirement specific enough to compare with the application's expected document-reading experience.

Can PDF.js display and verify certificate-based digital signatures?

Historical issue #1076 contains a maintainer's statement that good digital-signature support still needed implementation. PDF.js Express separately describes hand-drawn signature annotations, and pucyta's fork describes detecting signature-related data. Keep those three operations separate in a feature checklist. For certificate validation, ask for a demonstration that answers the application's trust requirements rather than accepting signature appearance as the result.

What we have not tested yet

Our recorded work covers source dependency setup and a quickstart that stopped before a PDF task. A corrected pdfjs-dist quickstart, completed source build, project-specific test suites, rendering fidelity, extraction accuracy and production performance remain untested. The November installation figures describe pdf.js 0.1.0 rather than Mozilla's distribution. Actual October runtime and operating-system versions require raw toolchain logs; the image label identifies the configured image. Neither run has screenshots or known-answer document-task results.

There is no common measured PDF corpus across current browsers, GPUs, mobile devices, physical printers or competing SDKs. Historical issue closure does not establish current behavior, universal fixes or support response times. Certificate trust validation, signature preservation, upstream existing-text editing, fork features, extraction reading order and table reconstruction need separate document tasks. The JSON search term alone does not identify an input format. The CVE post supplies no version-specific advisory or remediation path, and the zero-advisory audit is not an assessment of hostile PDFs or application authorization. No corrected example or command in this review was executed as part of this revision.

Alternatives

ProjectWhat it isPick it when
React-PDFReact components for displaying existing PDFs using PDF.js.Choose it when Document and Page components fit your React application and you will build the surrounding controls.
pdf-libA JavaScript library for creating and modifying PDF documents.Choose it for document generation or modification, with a separate viewer when your application also needs display.
PDF.js ExpressA commercial viewer whose vendor offers packaged annotations, form filling and hand-drawn signing.Evaluate it when those packaged workflows could reduce the interface work your team must implement.
Apryse WebViewerA commercial document SDK marketed for editing, permanent redaction and additional file formats.Evaluate it when your requirements include those workflows and the commercial licence and feature selection fit your application.

Sources

  1. Mozilla PDF.js README
  2. Mozilla getting started
  3. PDF.js release v6.5.438
  4. pdfjs-dist npm metadata
  5. React-PDF README
  6. pdf-lib README

More web reviews