mrkeyoor.com_
Tue 01 Sept 17:42 UTC
Webevaluationupdated 25 Aug 2026

pdf.js review

PDF.js is Mozilla's JavaScript engine and browser viewer for parsing and rendering PDF files with web technologies. It gives web applications a controllable PDF experience instead of handing every document to the browser's built-in reader.

+27stars / 7d
Verdict

Our PDF.js install pulled 761 packages and occupied 331 MB, so use the source repository when you need control over a serious browser PDF engine, not for a basic embed. It is the strongest open choice for teams willing to own viewer integration and PDF regression testing. React applications should try React-PDF first, and simple document panes should stay with native browser embedding.

We ran it

Lab card: what happened when we ran pdf.jsScreenshot of pdf.js (mozilla.github.io/pdf.js)
Install✓ · 73s761 packages · 331 MB
Buildn/ano build script
Testsn/ano test script
Known vulns00 critical · 0 high · 0 moderate · 0 low (npm audit)
Repo2543 files~264,715 lines of source · 157.1 MB · 15 CI workflows · tests dir

Answers from our run

Does pdf.js build from source?

Dependencies installed in 73 seconds (761 packages), and the project has no separate build step. We cloned commit 2cfbdb5 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 that only need the browser's native PDF pane: the README's source path installs hundreds of packages and uses Gulp, while a small embed helper avoids owning a viewer.

What are the alternatives to pdf.js?

React-PDF, PDFObject, pdf-lib. Our PDF.

Setup3/5Install works, but 761 packages lead into a custom Gulp workflow
Docs4/5Clear source, build, coverage, API, examples, and browser guidance
Community5/5Mozilla backing and issue and pull-request work active in August 2026
Maturity5/5Firefox use and a long release history support production adoption

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 teams that need a PDF viewer they can inspect, adapt, and ship under Apache 2.0.
Developers who need text selection, forms, annotations, search, or document structure exposed through JavaScript.
Browser and document-tool maintainers prepared to test unusual fonts, images, forms, and encrypted files.
Contributors who need the same engine and viewer code used by Firefox rather than a thin embed helper.

Who it’s NOT for

Teams that only need the browser's native PDF pane: the README's source path installs hundreds of packages and uses Gulp, while a small embed helper avoids owning a viewer.
React developers seeking a ready component API: PDF.js supplies the engine and generic viewer, while React-PDF wraps it around React conventions.
Projects with a strict JavaScript budget: the README calls the generated PDF.js files large and tells production users to minify them.
Maintainers expecting standard npm run build and npm test entry points: commit 2cfbdb5 exposes neither, and the documented build and test jobs are separate Gulp tasks.
Products that cannot test PDF edge cases themselves: release v6.2.108 includes fixes across fonts, images, forms, signatures, text selection, encryption, and structure trees.

Setup reality

Our measurement setup installed 761 packages in 73 seconds and used 331 MB on disk. We measured 2,543 files, about 264,715 source lines, and a 157.1 MB checkout. There was no npm build script or test script, so we skipped both rather than substituting undocumented commands. The npm audit reported 0 known vulnerabilities.

PDF.js needs no hosted account, secret, or external service. Source development does require a local HTTP server because browsers may block PDFs opened through file://; the README uses npx gulp server on port 8888. Production bundles come from npx gulp generic or generic-legacy, not an npm script.

Commit 2cfbdb5 requires Node 22.13 or newer, or Node 24. The modern viewer assumes current JavaScript support, while older browsers need the separate legacy build. Applications must ship both the main library and worker output, even though the worker is loaded automatically.

PDF.js gives you a browser PDF engine, not a drop-in component

PDF.js has shipped in Firefox since v19, and the same JavaScript engine parses and renders PDFs for other web applications. Mozilla describes it as a general-purpose, web-standards platform. The repository contains the lower-level display library and a generic viewer with familiar document controls. Teams reach for it when a native browser pane is too opaque to adapt.

The distinction between engine and component matters. PDF.js loads documents, renders pages, exposes text, and supports a full viewer, but the README sends application developers to the prebuilt pdfjs-dist package. React-PDF wraps the same engine for React. If your requirement is simply "show this PDF," cloning 2,543 files is the expensive route. Choose the source when viewer behavior is part of your product.

The generic viewer handles more than canvas painting

Release v6.2.108 changed annotation editing, font conversion, digital signature verification, encrypted files, AcroForm data, and structure trees. A PDF viewer also has to deal with text selection, links, images, fonts, document outlines, search, and worker communication. That list explains both the project's value and its maintenance burden.

PDF.js gives developers more control than a native embed. The API documentation and examples cover loading and rendering through JavaScript, while the supplied viewer is a reference implementation. The 2 generated files, pdf.js and pdf.worker.js, are both required; the main script loads the worker. The README calls them large and recommends minification, so teams should measure their delivery cost.

What happened when we ran it

Our run at commit 2cfbdb5 installed 761 npm packages in 73 seconds. The dependency tree occupied 331 MB, while the checkout measured 157.1 MB across 2,543 files and roughly 264,715 lines of source. Installation succeeded in an unprivileged Debian container with 3 CPUs, 8 GB of RAM, Node 22, and no secrets. The npm audit found 0 known vulnerabilities at every reported severity.

The package exposed no npm build target and no npm test target, so both stages were skipped. The repository still has a tests directory, 15 CI workflow files, and documented Gulp tasks for browser, Node, integration, and reference tests. A generic npm-script harness cannot exercise them without project-specific knowledge. There was no Dockerfile, so contributors inherit the host and browser setup described by the project.

Source development uses Gulp and a current Firefox

Development requires Node 22.13 or newer and opens a Gulp server on port 8888. The instructions assume the latest Firefox, and a server is required because browsers may refuse PDF access through a file:// URL. Node 24 is also supported. Those requirements are more specific than a normal library install.

Production output comes through 2 build versions. npx gulp generic builds the current-browser viewer, while generic-legacy targets older browsers. The modern demo assumes recent JavaScript features. That split leaves compatibility policy with the integrator: decide which build to serve, wire asset paths, include the worker, and test every supported browser.

PDF edge cases make regression testing part of adoption

Version v6.2.108 maps where real PDFs become difficult. It includes fixes for AES-256 passwords with non-ASCII characters, signature fields with widget children, inherited form resources, Unicode attachment names, soft masks, JPX images, and missing font behavior. These are documents that can render, select, save, or verify incorrectly when an implementation misses one corner of the format.

A team shipping PDF.js should keep representative user documents and test interaction as well as pixels. Forms need save checks, selectable text needs copy checks, and encrypted files need non-ASCII password cases. The repository documents 4 test groups: reference, integration, browser, and Node. Our lab did not run them because no npm test target existed, so our result cannot certify rendering fidelity.

Active work and Mozilla support make the upkeep credible

The repository was pushed on 2026-08-25, the date of this review, and issues and pull requests received updates that week. GitHub reported 414 open issues and PRs together, a work queue rather than a defect count. Release v6.2.108 arrived on 2026-07-28 with changes to browser behavior, accessibility, document parsing, tests, and dependencies.

Documentation has 4 useful layers: the README handles setup and builds, the wiki covers integration and browsers, API pages describe the library surface, and examples show direct use. The repository publishes coverage through 3 separate unit, integration, and browser workflows. Newcomers still have to learn the project's task vocabulary instead of relying on familiar npm scripts.

Use the source when the viewer is part of your product

PDF.js fits a team building a document workspace, annotation interface, browser extension, or specialized reader. Apache 2.0 licensing, current maintenance, and Firefox deployment reduce adoption risk. The trade is ownership: budget for a 331 MB installed tree during development, custom Gulp tasks, browser-specific output, worker assets, and document regression fixtures.

For a React page, start with React-PDF and drop lower only when its component model blocks you. For a plain document link, native browser embedding through PDFObject may be enough. Choose pdf-lib when editing or generating files is the requirement. PDF.js earns its weight when you need to control how a PDF is parsed, rendered, searched, selected, or annotated inside the browser.

Alternatives

ProjectWhat it isPick it when
React-PDFA React component layer that uses PDF.js underneath and fits normal React rendering patterns.pick this instead when you want pages inside a React component tree without assembling the lower-level PDF.js viewer yourself.
PDFObjectA small browser helper that embeds PDFs through native browser support.pick this instead when a native PDF pane is enough and you do not need PDF.js rendering or viewer controls.
pdf-libA JavaScript library for creating and modifying PDF documents in browsers and Node.js.pick this instead when the main job is writing, filling, merging, or changing PDFs rather than displaying them.

What people are saying

  1. [velocity-scout] mozilla/pdf.js

Sources

  1. PDF.js README
  2. PDF.js repository
  3. PDF.js v6.2.108 release
  4. PDF.js API documentation

More web reviews

axios · super-productivity · Graphite · fastify · tabler · go-zero · the whole board →