How to Manually Call Firefox Built-in PDF Viewer (pdf.js)

bookmarkletbrowserfirefoxpdf

I have disabled Firefox's native PDF viewer so each PDF link doesn't open automatically and gets downloaded by default. And I like it that way.

But I still want to open some PDFs in the viewer. So the question is: what can I do to call the viewer manually without switching default action every time? Like using some protocol handler similar to viewing sources (view-source:<url>), extension or bookmarklet JS code?

Best Answer

In Firefox web browser, go to resource://pdf.js/web/viewer.html

The resource URL scheme will manually call the built-in PDF viewer. For some reason, the 'Open File' button in the viewer is useless in Firefox on Linux; the file selection dialog will not appear. The workaround is to drag and drop PDF file into the built-in viewer.

  1. Open a new window of Firefox web browser.

  2. In the address bar, type resource://pdf.js/web/viewer.html and hit Enter key. An empty viewer will load.

  3. Open another window of Firefox web browser and visit the page where it contains link to PDF file i.e. google "example adobe .pdf" to find relevant results.

  4. Click on target link once and hold, then move (drag) into the empty viewer and release (drop).

  5. The empty viewer will open the PDF file and the address bar will change from resource:// to https:// or such relevant URL.

The following screenshot combo illustrates the explained steps.

Firefox built-in PDF viewer drag and drop

Drag and drop works for links to PDF file, as well as for local documents. Instead of link, drag the file icon from a File Manager into the empty viewer. The PDF file will open similarly.

Tested working in Firefox 50.1.0 (legacy) and 57+ (Firefox Quantum) on Linux.