Skip to content

Frequently Asked Questions

frederic-mahe edited this page Mar 7, 2013 · 15 revisions

Can I specify different PDF in the default viewer?

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.

Can I load a PDF from another server (cross domain request)?

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.

What browsers are supported?

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.

What browsers have extensions(and where can I find install procedures)?

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.

I know JavaScript and want to contribute to the project. How do I start?

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.

Is it possible to add annotations to a PDF?

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.

What are the pdf.js keyboard shortcuts?

(warning, the following list may be incomplete)

Navigation

  • 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.

Zoom and rotate

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)