PDF.js
A strong pick. 1st of 9 PDF libraries.
PDF.js is Mozilla's PDF parser and renderer, the engine behind Firefox's built-in viewer. It is the default open-source choice for showing PDFs in a browser and for pulling text out of them. It cannot create new PDFs, so pair it with a generator such as pdf-lib, PDFKit or pdfmake when you need one.
Best for: Web apps that must display, search or extract text from PDFs with consistent rendering across browsers.
Scores
Overall8.7
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
It is the default open-source pick for rendering and reading PDFs in JavaScript. It is funded, very active and more widely used than any peer. It is not a 9+ for the whole category because it cannot create PDFs. Fiddly Node and bundler setup and recurring script-injection fixes mean you need to stay on current versions.
- github commitsLastYear: Very active maintenance.
- npm downloadsLast4Weeks: Highest downloads in the category, growing well above the median.
- dev.to/joyfill/comparing-open-source-pdf-libraries-2025-edition-401g: Best for rendering. Not for generation.
- advisories.gitlab.com/npm/pdfjs-dist/CVE-2026-16633: Recent high-severity XSS fixed.
GPT-6.2 Sol: 8.8, likely 7.6 to 9.6
PDF.js is the first choice among these peers for a custom browser viewer because it combines a capable rendering engine, active maintenance, and established production use. React-PDF offers a simpler React interface, unpdf simplifies serverless extraction, and PDFKit is better suited to generating documents. Worker setup, performance on complex PDFs, and recurring security fixes keep the score below a universal recommendation for PDF work.
- github.com/mozilla/pdf.js/releases/tag/v6.5.438: The stable release continues improving rendering, accessibility, and viewer features.
- github.com/nextcloud/files_pdfviewer: Shows an established production integration outside Mozilla.
- github.com/wojtekmaj/react-pdf: Provides React components over the same engine and documents worker setup.
- github.com/unjs/unpdf: Wraps PDF.js for extraction in Node.js and serverless runtimes.
- pdfkit.org: Provides an API for authoring new PDFs from application data.
- github.releasesLastYear, advisories: Regular releases support continued use, and the advisory history makes timely upgrades important.
Needed by many5.3
How many developers need a tool for this job?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
Many web apps need to show PDFs, and text extraction for search and AI pipelines has widened that need. Still, plenty of projects never touch PDFs. Within the category it covers reading and showing but not making files.
- dev.to/joyfill/comparing-open-source-pdf-libraries-2025-edition-401g: Rendering only. Not for generation or editing.
- nutrient.io/blog/pdfjs-server-side-text-extraction: Also used on servers to extract text.
GPT-6.2 Sol: 4.5, likely 3.2 to 5.8
PDF viewing and extraction serve a clear niche across document portals, business apps, and ingestion pipelines. PDF.js works without a frontend framework and supports some Node.js use, while its API centers on existing documents. The available developer survey gives little basis for estimating how many teams need embedded PDF handling.
- mozilla.github.io/pdf.js/getting_started: Describes the parser, display API, and embeddable viewer.
- mozilla.github.io/pdf.js/examples: Links to browser and Node.js examples.
- 2025.stateofjs.com/en-US/other-tools: Provides no PDF.js-specific usage figure.
Helps a lot8.6
How well does it do the job for those who need it?
Claude Opus 5.5: 8.5, likely 7.5 to 9.0
Independent comparisons call it a highly reliable renderer with broad PDF support. It is the reference engine that many viewers and wrappers build on, and recent releases added signature verification, a renderer worker and annotation editing. Points come off because it cannot generate PDFs, bundler and Node setup is fiddly, and wrappers like unpdf exist to hide those rough edges.
- dev.to/joyfill/comparing-open-source-pdf-libraries-2025-edition-401g: Called a highly reliable rendering engine. Cannot create or edit PDFs.
- github.com/mozilla/pdf.js/releases: v6.2 added signature verification. v6.5 moved canvas drawing to a worker.
- polotno.com/sdk/product/compare/javascript-pdf-libraries-compared: Recommended for display. No redaction, OCR or text editing.
- cdn.jsdelivr.net/npm/unpdf@1.8.0/README.md: Wrapper exists because Node and serverless setup is awkward.
- npm hasTypes: Ships its own TypeScript types.
GPT-6.2 Sol: 8.7, likely 7.5 to 9.5
Version 6.5.438 combines a mature viewer with a typed API for rendering, text extraction, and annotations. Official examples give coding agents a clear starting point, and an integrator reported that dependency hoisting can still load an incompatible worker. A competing renderer’s Node.js benchmark found slower first renders and higher memory use than PDFium, and a current user report documents clipped variable-font glyphs on macOS. Performance and fidelity depend on the files and runtime.
- github.com/mozilla/pdf.js/releases/tag/v6.5.438: Current stable release improves accessibility, annotation handling, and large-image rendering.
- mozilla.github.io/pdf.js/examples: Shows document loading, page rendering, and worker setup.
- npm.hasTypes: The npm package ships TypeScript declarations.
- reddit.com/r/javascript/comments/1vqf0pq/askjs_i_reproduced_a_pdfjs_worker_mismatch_caused: An integrator reports a worker mismatch in a project with two PDF.js versions.
- cfip-stage.cueflip.com/es/research/rethinking-pdf: A competing renderer’s benchmark measures first-render time and memory for version 6.5.438 in Node.js on macOS.
- github.com/mozilla/pdf.js/issues/22492: A font developer reports clipped variable-font glyphs in the current demo.
Holds up over time9.3
Will it still be a good choice in two years?
Claude Opus 5.5: 9.5, likely 8.5 to 10.0
Mozilla funds it and ships it in Firefox. It had 3,189 commits and 12 releases in the last year, and 543 people have contributed over its history. Issues are handled at scale, with 382 open against 10,316 closed. The only drag is frequent API-minor changes and a v6.0 major that removed older call forms.
- github commitsLastYear: 3,189 commits in the last year.
- github releasesLastYear: 12 releases. Latest on 2026-11-01.
- github openIssues/closedIssues: 382 open against 10,316 closed.
- github.com/mozilla/pdf.js/releases: v6.0 api-major removals. Many api-minor return-type changes.
GPT-6.2 Sol: 9.0, likely 8.0 to 9.8
Mozilla ships PDF.js in Firefox, several contributors maintain it, and the bundle records 12 releases and 3,189 commits in a year. Maintainers responded the same day to a recent font report, and downstream projects are adopting version 6. One maintainer is listed on the recent GitHub releases, and the number of people who can trigger npm publication is unclear. Version 6 also required changes to some direct API calls and raised browser requirements.
- github.commitsLastYear, github.releasesLastYear: 3,189 commits and 12 releases over the last year.
- searchfox.org/firefox-main/source/toolkit/components/pdfjs: Firefox maintains an in-tree PDF.js integration.
- github.com/mozilla/pdf.js/releases: Several contributors recur in release notes and one maintainer is listed on recent releases.
- github.com/mozilla/pdf.js/issues/22492: Maintainers responded to the font report on the day it was filed.
- github.com/wojtekmaj/react-pdf/releases/tag/v11.0.0: React-PDF adopted PDF.js 6 and documented compatibility changes.
Used widely7.8
How many use it, and is that growing?
Claude Opus 5.5: 9.0, likely 8.0 to 9.5
It has 225M downloads in 4 weeks, up about 10.9x against a median of 4.1x, which is the category's highest. Many of those come through wrappers such as react-pdf, React-PDF viewer and unpdf, so direct choice is lower than raw installs suggest. Its 17.8k dependent repos and 54k stars, the most among peers, still show very wide direct use.
- npm downloadsLast4Weeks: 225.5M, against 20.7M a year earlier (about 10.9x).
- dependents: 17,822 repos and 1,630 packages.
- github stars: 54k stars, the most in the category.
- polotno.com/sdk/product/compare/javascript-pdf-libraries-compared: Leads npm downloads over the past 12 months.
GPT-6.2 Sol: 6.6, likely 5.3 to 7.8
Four-week npm downloads rose from 20.7 million to 225.6 million, or 10.9× against the 4.1× catalog baseline. That leads the peer group in volume, while PDFKit, pdf-lib, and unpdf grew faster from smaller bases. The 17,822 tracked dependent repositories exceed the React-PDF viewer’s count and trail PDFKit, jsPDF, and pdfmake. Automated and transitive installs inflate npm counts, while CDN and bundled use leave the number of direct choices uncertain.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 225.6 million versus 20.7 million downloads, up 10.9× against a 4.1× baseline.
- dependents, peers: 17,822 tracked repositories and 1,630 packages, with three peers ahead on repository count.
- github.stars, bluesky.posts: 54,164 stars lead the group, while four recent Bluesky links give a weak attention signal.
- github.com/wojtekmaj/react-pdf/releases/tag/v11.0.0: React-PDF accounts for some installs through its PDF.js dependency.
- mozilla.github.io/pdf.js/getting_started: Provides direct downloads and CDN distribution outside npm installs.
Vouched for8.9
Who stands behind it being good?
Claude Opus 5.5: 9.0, likely 8.0 to 9.5
Firefox ships it to hundreds of millions of users. Many viewers and tools build on it, including React-PDF viewer, unpdf and Polotno's importer. Independent and vendor comparisons alike name it the standard for rendering, though no developer survey covers this category.
- Firefox built-in PDF viewer: Ships in Firefox as the default viewer.
- polotno.com/sdk/product/compare/javascript-pdf-libraries-compared: Polotno uses it to parse PDFs.
- dev.to/joyfill/comparing-open-source-pdf-libraries-2025-edition-401g: Independent comparison rates it as reliable and highly active.
- dependents packages: 1,630 npm packages build on it.
GPT-6.2 Sol: 8.8, likely 7.7 to 9.7
Firefox and Nextcloud ship PDF.js in their viewers, and React-PDF and unpdf continue to invest in it as their rendering engine. These deployments cover both browser viewing and server-side extraction. Survey evidence on developer satisfaction is thin, and the available benchmarks cover specific workloads.
- searchfox.org/firefox-main/source/toolkit/components/pdfjs: Firefox ships and tests its PDF.js integration.
- github.com/nextcloud/files_pdfviewer: Nextcloud uses PDF.js in its file viewer.
- github.com/wojtekmaj/react-pdf/releases/tag/v11.0.0: React-PDF 11 upgraded its rendering engine to PDF.js 6.
- github.com/unjs/unpdf: Unpdf ships a serverless build of PDF.js 6.5.438.
- 2025.stateofjs.com/en-US/other-tools: Provides no project-specific satisfaction or retention result.
Safe7.6
How safe is it to depend on?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
It has no dependencies, an Apache-2.0 licence and a Scorecard of 8.3 with fuzzing and SAST. Releases are not signed. It parses untrusted files, and three high-severity script-injection advisories (2022, 2024, 2026) show this is a recurring risk. The 2026 bug was exploitable with default scripting on and was fixed in 6.2.108. Setting a strict CSP and keeping current lowers the risk.
- advisories: Three high-severity advisories, one in the last 24 months.
- advisories.gitlab.com/npm/pdfjs-dist/CVE-2026-16633: 2026 XSS fixed in 6.2.108. Exploitable with default enableScripting.
- scorecard: Score 8.3. Signed-Releases 0. CII 0.
- npm dependencies: No runtime dependencies.
GPT-6.2 Sol: 7.6, likely 6.4 to 8.6
The Apache-2.0 package has zero required npm dependencies, and Node.js rendering can use an optional native canvas package. All three listed high-severity advisories have fixed versions, and the latest fix shipped in 6.2.108 by public disclosure. The 8.3 Scorecard reflects strong review and fuzzing, with a zero for signed releases and an unverified branch-protection result. GitHub Actions handles npm publication, while recurring viewer vulnerabilities and limited visibility into publisher access keep the range wide.
- npm.dependencies, npm.license, scorecard: Zero required dependencies, Apache-2.0, and an 8.3 Scorecard with full review and fuzzing scores.
- github.com/unjs/unpdf: Documents pdfjs-dist’s optional native Node.js canvas dependency.
- github.com/advisories/GHSA-hq66-cqwq-w95j: The 2026 high-severity advisory lists 6.2.108 as patched.
- github.com/mozilla/pdf.js/releases/tag/v6.2.108: The patch release shipped on July 28, the date of the upstream advisory.
- github.com/advisories/GHSA-wgrm-67xf-hhpq: The 2024 high-severity advisory lists 4.2.67 as patched.
- github.com/advisories/GHSA-7jg2-jgv3-fmr4: The older viewer vulnerability has fixes on both affected release lines.
- github.com/mozilla/pdf.js/wiki/Release-Process: Documents GitHub Actions publishing the npm release.
Good
- It is the most complete open-source PDF renderer in JavaScript, tested daily by shipping inside Firefox.
- Mozilla pays for active maintenance, with about 3,200 commits and monthly releases in the last year.
- It has no runtime dependencies, ships its own TypeScript types and uses the permissive Apache-2.0 licence.
- It includes a full viewer with text selection, forms, annotation editing and, since v6.2, signature verification.
Bad
- It cannot generate PDFs, so it covers only the read-and-show half of the category.
- Worker setup, CMap and font paths, and the legacy build for Node and serverless are common sources of friction.
- Malicious PDFs have led to repeated high-severity script-injection bugs (2022, 2024, 2026), so users must keep it patched.
- Minor releases often change API return types, and v6.0 removed older call forms, so upgrades can need code changes.
The numbers
- npm downloads, 4 weeks
- 226M ×11 in a year
- GitHub stars
- 54k
- Commits, 12 months
- 3.2k
- npm version
- 6.5.438 Nov 2026
- Versions, 12 months
- 12
- Advisories, 24 months
- 1 of 3 ever
- OpenSSF Scorecard
- 8.3 out of 10, Oct 2026
- Licence
- Apache-2.0
Read on 21 November 2026 from GitHub (mozilla/pdf.js), npm (pdfjs-dist), OSV and the OpenSSF Scorecard.
PDF libraries
- 8.7PDF.js
- 7.6PDFKit
- 7.4React-PDF viewer
- 7.4unpdf
- 7.3React-pdf renderer
- 7.2pdfmake
- 6.9pdfme
- 6.4jsPDF
- 4.9pdf-lib