Unlike Google Chrome, Chromium doesn't ship with a built-in PDF viewer. To get around this issue, you need to use Mozplugger which is a Mozilla plugin that allows external viewers to be executed inside the browser itself.


First, make sure you have installed Mozplugger:

sudo apt-get install mozplugger

To make Chromium open PDF files in Evince, you need to configure Mozplugger:


mkdir ~/.mozplugger
cp /etc/mozpluggerrc ~/.mozplugger/mozpluggerrc

Now open mozpluggerrc in your favorite text editor:

vim ~/.mozplugger/mozpluggerrc

Locate the following lines in the aforementioned configuration file (i.e . mozpluggerrc):

### Acrobat Reader
define(ACROREAD, [repeat swallow(acroread) fill : acroread -openInNewWindow /a "$fragment" "$file"])

Then replace them with:

### Evince
define(EVINCE, [repeat swallow(evince) fill needs_xembed: evince "$file"])

We are not done yet. In the same file, you need to substitute ACROREAD() with EVINCE(). After this modification, the configuration file should look something like this:

text/x-pdf:pdf:PDF file
EVINCE()
repeat noisy swallow(Xpdf) fill needs_xembed: xpdf -g +9000+9000 "$file"
repeat noisy swallow(okular) fill needs_xembed: okular "$file"
repeat noisy swallow(epdfview) fill needs_xembed: epdfview "$file"
GV()
repeat noisy swallow(evince) fill needs_xembed: evince "$file"

Save your file and open Chromium. To check the plugin state, type the following line into the address bar:

chrome://plugins


From now on, Chromium will open PDF files inside the browser using Evince.

Comments