- Notifications
You must be signed in to change notification settings - Fork10.5k
mozilla/pdf.js
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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 tocreate a general-purpose, web standards-based platform for parsing andrendering PDFs.
PDF.js is an open source project and always looking for more contributors. Toget involved, visit:
Feel free to stop by ourMatrix room for questions or guidance.
Please note that the "Modern browsers" version assumes native support for thelatest JavaScript features; please also seethis 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
PDF.js is built into version 19+ of Firefox.
- The official extension for Chrome can be installed from theChrome Web Store.This extension is maintained by@Rob--W.
- Build Your Own - Get the code as explained below and issue
npx gulp chromium. Then openChrome, go toTools > Extensionand load the (unpackaged) extension from thedirectorybuild/chromium.
To get a local copy of the current code, clone it using git:
$ git clone https://github.com/mozilla/pdf.js.git$ cd pdf.jsNext, install Node.js via theofficial package or vianvm. If everything worked out, installall dependencies for PDF.js:
$ npm installFinally, you need to start a local web server as some browsers do not allow openingPDF files using afile:// URL. Run:
$ npx gulp serverand then you can open:
Please keep in mind that this assumes the latest version of Mozilla Firefox; refer toBuilding 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:
In order to bundle allsrc/ files into two production scripts and build the genericviewer, run:
$ npx gulp genericIf you need to support older browsers, run:
$ npx gulp generic-legacyThis will generatepdf.js andpdf.worker.js in thebuild/generic/build/ directory (respectivelybuild/generic-legacy/build/).Both scripts are needed but onlypdf.js needs to be included sincepdf.worker.js willbe loaded bypdf.js. The PDF.js files are large and should be minified for production.
To use PDF.js in a web application you can choose to use a pre-built version of the libraryor to build it from source. We supply pre-built versions for usage with NPM underthepdfjs-dist name. For more information and examples please refer to thewiki page on this subject.
PDF.js is hosted on several free CDNs:
- https://www.jsdelivr.com/package/npm/pdfjs-dist
- https://cdnjs.com/libraries/pdf.js
- https://unpkg.com/pdfjs-dist/
You can play with the PDF.js API directly from your browser using the live demos below:
More examples can be found in theexamples folder. Some of them are using the pdfjs-dist package, which can be built and installed in this repo directory vianpx gulp dist-install command.
For an introduction to the PDF.js code, check out the presentation by ourcontributor Julian Viereck:
More learning resources can be found at:
The API documentation can be found at:
Check out our FAQs and get answers to common questions:
Talk to us on Matrix:
File an issue:
About
PDF Reader in JavaScript
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.