HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mozilla
pdf.js
JavaScript2012–2026
mozilla / pdf.js

pdf.js

PDF Reader in JavaScript

60Distinct people
67Mentions
1Explicit recommenders
54.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

PDF Reader in JavaScript

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

> Since you've done some work on it, I'll assume you understand the architecture well. Alas, no :) My work was basically a few surgical strikes in which I learned a lot about a…

nnethercote used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 8:59:20 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year67 dated mentions

Observed mentions: 2012-01-27 17:53:12 UTC to 2026-10-30 08:12:16 UTC.

02468102012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC505
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC615
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC10010
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC404
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC505
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC413
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC303
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC303
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC808
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC202
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC606
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC211
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC505
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC110

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
PDF.js PDF.js is a Portable Document Format (PDF) viewer that is built with HTML5. PDF.js is community-driven and supported by Mozilla. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs. Contributing PDF.js is an open source project and always looking for more contributors. To get involved, visit: Issue Reporting Guide Code Contribution Guide Frequently Asked Questions Good Beginner Bugs Projects Feel free to stop by our Matrix room for questions or guidance. Getting Started Online demo Please note that the "Modern browsers" version assumes native support for the latest JavaScript features; please also see this wiki page. Modern browsers: https://mozilla.github.io/pdf.js/web/viewer.html Older browsers: https://mozilla.github.io/pdf.js/legacy/web/viewer.html NoteOpen new files via the menu (the ">>" icon) or by dragging and dropping. Browser Extensions Firefox PDF.js is built into version 19+ of Firefox. Chrome The official extension for Chrome can be installed from the Chrome Web Store. This extension is maintained by @Rob--W. Build Your Own - Get the code as explained below and issue npx gulp chromium. Then open Chrome, go to Tools > Extension and load the (unpackaged) extension from the directory build/chromium. PDF debugger Browse the internal structure of a PDF document with https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html Getting the Code To get a local copy of the current code, clone it using git: $ git clone https://github.com/mozilla/pdf.js.git $ cd pdf.js Next, install Node.js via the official package or via nvm. If everything worked out, install all dependencies for PDF.js: $ npm install Finally, you need to start a local web server as some browsers do not allow opening PDF files using a file:// URL. Run: $ npx gulp server and then you can open: http://localhost:8888/web/viewer.html Please keep in mind that this assumes the latest version of Mozilla Firefox; refer to Building PDF.js for non-development usage of the PDF.js library. It is also possible to view all test PDF files on the right side by opening: http://localhost:8888/test/pdfs/?frame Building PDF.js In order to bundle all src/ files into two production scripts and build the generic viewer, run: $ npx gulp generic If you need to support older browsers, run: $ npx gulp generic-legacy This will generate pdf.js and pdf.worker.js in the build/generic/build/ directory (respectively build/generic-legacy/build/). Both scripts are needed but only pdf.js needs to be included since pdf.worker.js will be loaded by pdf.js. The PDF.js files are large and should be minified for production. Code coverage We track how much of the code is exercised by the test suite on Codecov (see the badge at the top of this file). How it is collected When coverage is enabled, the build instruments the bundled code with babel-plugin-istanbul, which adds counters that record every line, branch and function that runs: For browser-based tests (unit, integration and reference tests) the instrumented code runs in the browser, fills a global window.__coverage__ object, and the test runner collects it from each browser session, merges the results, and writes the report. For the Node-based unit tests (unittestcli) the raw data is written to build/tmp/unittestcli-coverage.json and turned into a report afterwards. Collecting coverage locally Add the --coverage flag to any of the test tasks, for example: $ npx gulp unittest --coverage # browser unit tests $ npx gulp unittestcli --coverage # Node unit tests $ npx gulp integrationtest --coverage # Puppeteer integration tests $ npx gulp botbrowsertest --coverage # reference tests The following options control the output: Option Description Default --coverage Enable coverage collection. off --coverage-output <dir> Directory where the report is written. build/coverage --coverage-formats <list> Comma-separated list of formats: info, html, json, text, cobertura, clover. info --coverage-per-test Also build a per-test index (see below). off By default the report is written to build/coverage in the info format, i.e. an LCOV lcov.info file (the same format that is uploaded to Codecov). Use --coverage-formats html to get a browsable HTML report instead, or pass several formats at once, e.g. --coverage-formats info,html. Finding which tests cover a given line coverage_search lists the ref tests that exercised a specific source line or function. It uses the per-test index (per-test-index.json) that is rebuilt on every push to master and published to the pdf.js.refs repository. The index is downloaded on demand, cached locally, and only re-downloaded when it has changed, so no local coverage build is required: $ npx gulp coverage_search --code="canvas.js::205" $ npx gulp coverage_search --code="canvas.js::drawImageAtIntegerCoords" To run — or regenerate the reference images for — only the ref tests that touch a given line or function, pass the same --code option to a browser test or makeref task: $ npx gulp browsertest --code="canvas.js::205" $ npx gulp makeref --code="canvas.js::205" Pass --no-download to reuse the locally cached index without contacting the network. The index can also be built and queried locally (the CI job that publishes it builds it the same way): $ npx gulp botbrowsertest --coverage-per-test $ npx gulp coverage_search --code="canvas.js::205" \ --index=build/coverage/per-test-index.json --no-download Continuous integration On every push and pull request three GitHub Actions workflows collect coverage and upload it to Codecov, each tagged with its own Codecov flag so the test types can be told apart: Workflow Task Codecov flag unit_tests.yml unittest unittest integration_tests.yml integrationtest integrationtest coverage_browser_tests.yml botbrowsertest browsertest Benchmarks Run the benchmarks in test/benchmarks/ locally: $ npx gulp benchmark To co
Read the full README on GitHub

What Hacker News says

10 sources
Add-ons can be distributed outside of AMO. A secondary (more scary) dialog is shown before the add-on can be installed, but users can click past it to get to the add-on. PDF.js uses this approach actually. See "Development version" at https://github.com/mozilla/pdf.js/ as an example.
In [dead]
Since you've done some work on it, I'll assume you understand the architecture well. My biggest gripe with pdf.js is that resizing triggers a full page reload, since it has to redraw the canvas. Whereas this is instant on other pdf readers. Would there be any workarounds for this? Or will we be stuck with this behaviour till "pdf.js 2.0". Edit: This is an example of what I'm talking about https://github.com/mozilla/pdf.js/issues/3853
In How fast is PDF.js?
> Will a bug filed at GitHub like https://github.com/mozilla/pdf.js/issues/4761 still reach the right place? Filing at Bugzilla will probably give you a wider audience. This can be useful if the underlying perf problem is with Firefox rather than pdf.js. Don't worry about getting some of the Bugzilla fields wrong, it happens all the time and people don't mind. A good description of the problem (with steps to reproduce) is the most important thing. If you're still intimidated, filing something with pdf.js's GitHub tracker is a lot better than nothing.
In How fast is PDF.js?
Reporting bugs in Firefox is intimidating to say the least. Will a bug filed at GitHub like https://github.com/mozilla/pdf.js/issues/4761 still reach the right place? bgirard's profiling work in this thread has been amazing, but I don't think I have the knowledge to interpret the profiler results well enough to file bugs on slow PDFs. A way to post "slow" PDFs to be picked up by pdf.js developers would help.
In How fast is PDF.js?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.