PDF.js is a JavaScript PDF viewer and parser built on web standards. Mozilla supports the project, and Firefox ships a built-in viewer from recent releases.
Overview
PDF.js implements parsing and rendering of Portable Document Format files using HTML5 APIs so PDFs can display inside web pages without a proprietary plugin. The goal is a general-purpose, standards-based platform for PDF viewing and manipulation in browsers and JavaScript applications.
The project ships a generic viewer, worker-backed rendering, and build artifacts suitable for embedding in sites. Prebuilt packages publish to npm as pdfjs-dist for application bundlers, and hosted demos illustrate modern and legacy browser builds. Developers can run a local gulp server when testing because some browsers block file:// PDF loading.
Firefox integrates PDF.js directly in the browser. A community-maintained Chrome extension loads an unpacked build produced via the project’s Chromium gulp target. API examples, interactive demos, and wiki guidance explain how to wire the library into custom apps, including CDN-hosted distributions.
Beyond display, the codebase includes tooling for bundling production scripts, optional legacy builds for older browsers, reference and integration tests, and coverage reporting. Contributing workflows point newcomers to issue and code guides and community chat channels.
Key features
- In-browser PDF parsing and rendering
- Generic embeddable web viewer
- Web worker for heavy PDF tasks
- npm pdfjs-dist distribution
- Built into Firefox viewer
- Chrome extension build target
- Legacy and modern browser bundles
- Interactive API examples
Use cases
- Embedding PDF viewing in web apps
- Browser-based document preview
- Firefox integrated PDF reading
- Chrome extension PDF viewer
- PDF rendering research on web standards