-
Notifications
You must be signed in to change notification settings - Fork 1
Frequently Asked Questions
- Can I specify different PDF in the default viewer?
- Can I load a PDF from another server (cross domain request)?
- What browsers are supported?
- What browsers have extensions (and where can I find install procedures)?
- I know JavaScript and want to contribute to the project. How do I start?
- Is it possible to add annotations to a PDF?
- What are the pdf.js keyboard shortcuts?
You can modify DEFAULT_URL variable in the web/viewer.js file. Or, you can append the ?file=
query string to the viewer URL, e.g. http://mozilla.github.com/pdf.js/web/viewer.html?file=compressed.tracemonkey-pldi-09.pdf
.
Not by default, but it is possible. PDF.js runs with the same permissions as any other javascript, which means it cannot do cross origin requests (see Same origin policy and example). There are some possible ways to get around this such as using CORS or setting up a proxy on your server that will feed pdf.js the pdf. Both workarounds are out of the scope of the pdf.js project and we will not provide code to do either.
The goal is to support all HTML5 compliant browsers, but since feature support varies per browser/version our support for all PDF features varies as well. If you want to support more browsers than Firefox you'll need to include compatibility.js which has polyfills for missing features. Find the list of features needed for PDF.js to properly work and browser tests for those features at Required Browser Features. In general, the support is below:
Browser | Supported | Automated Testing | Notes |
---|---|---|---|
Firefox Stable | yes | Windows and Linux | |
Chrome Stable | yes | Windows and Linux | |
Opera Stable | yes | none | |
IE9 | limited | none | IE9 lacks a number of features and most notably typed arrays which causes subpar performance. |
<=IE8 | NO | none | IE8 and below are missing too many features to be supported. |
There is currently a Firefox and Chrome extension. The Firefox extension is well supported and actively worked on. The Chrome extension is less active and more experimental. For installing either see the readme.
First, you need to prepare your fork and setup the development environment. Don't forget to read the Contributing page. Second, make yourself familiar with the PDF format and PDF.js internals. Third, if you don't already have a certain issue you want to fix, choose one from the open issues labeled 5-good-beginner-bug. Last, submit a pull request for the review. During any part of the process we recommend to communicate with the PDF.js team on #pdfjs IRC channel at irc.mozilla.org if you have questions or need to find a reviewer.
PDF.js is mainly written for reading PDF files, not editing them. Because of that we don't yet support adding any kind of annotations. We do however support rendering a number of annotation types.
(warning, the following list may be incomplete)
- next page: n, k, right arrow key
- previous page: p, j, left arrow key
In full screen mode, the home, end, page up, page down, and all arrow keys can be used to navigate the document.
User interface buttons or ctrl + mouse wheel can be used to change the zooming level, but keyboard shortcuts are also available:
- zoom in: ctrl + "+", ctrl + =
- zoom out: ctrl + -
- restore normal zoom: ctrl + 0 (in full screen mode)
- rotate the document clockwise: r
- rotate counterclockwise: shift + r
(replace ctrl with meta on some configurations)