Home

Embed pdf viewer in firefox (29+) using mozplugger

Updated:
Created:

How to get pdfs embedded in webpages after the upgrade to ubuntu trusty with firefox 29.

Problem

One can preview pdfs in firefox using the built in firefox-pdfjs tool. In my use case I'd rather use evince to see a more 'real' rendering of the pdf. How do I get this to work? I installed mozplugger, but still no luck - embedded pdfs in webpages either don't show at all, or open an external viewer.

Solution

Install mozplugger

Copy /etc/mozpluggerrc to ~/.mozplugger/mozpluggerrc

Modfiy mozpluggerrc to your liking. In my case this means it has a section for pdfs and postscript looking like this:

application/pdf:pdf:PDF file
application/x-pdf:pdf:PDF file
text/pdf:pdf:PDF file
text/x-pdf:pdf:PDF file
application/x-postscript:ps:PostScript file
application/postscript:ps:PostScript file
    repeat noisy swallow(evince) fill: evince "$file"

Make sure you have the right settings in firefox 'about:config':

  1. Change pdfjs.disabled's value to true;
  2. Change plugin.disable_full_page_plugin_for_types's value to an empty value.

Restart firefox

References