Open PDF with Chromium in Linux using the in-browser PDF viewer

Chromium is the open source version of Google Chrome.
There are some none-open source stuff in it that has been left out, a good example is the Chrome in-browser PDF viewer.

I needed this back, since I like it. so I did some googling around. I found lots a lots of posts, and none of them worked. But when I finally got it working, I decided to make this post hoping it will help others like me!

So this will be a short post on how to enable the in-browser PDF viewer in Chromium.

Downloading the needed files

First you need to download the needed files, in this case it is the official Chrome browser.
You can get it by running the following, or downloading the .deb package directly at https://www.google.com/intl/en/chrome/browser/ and choosing 32 or 64bit Debian/Ubuntu package depending on whether you use a 64 or 32bit Linux OS.

You can also do the following from a terminal:

For 64Bit:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

For 32Bit:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

Extract the .deb package

What you just downloaded was a Debian package, you can see it as an “archive” like a .zip or .tar.gz, if that makes more sense to you.
You need to extract it, since the one file we need is hidden deep inside it.

Extract it by running the following in the terminal:

ar xv <filename of downloaded file>

Example:

ar xv google-chrome-stable_current_amd64.deb

In case you get the “ar: command not found” error. Install binutils using the following command and then run the above command again:

apt-get install binutils

If the extract command above was successfull, you now have 3 new files in the same location as you first file. They are named the following:
data.tar.lzma
debian-binary

What we are interested in here is the data.tar.lzma file, this is another “archive” and we also have to extract this, using the following command:

tar --lzma -xvf data.tar.lzma

This time you get some folder, with a lot of subfolders and files, the 3 top folder are named:
etc
opt
usr

In all this, we are only interested in 1 file, opt/google/chrome/libpdf.so

Copy the needed file to you Chromium install folder

copy it to your Chromium install folder using the “cp” command:

The folder might not be exactly the same for you, depending on your Chromium version and OS. but for me it’s /usr/lib/chromium/ and should be something like that for you, just type in “/usr/lib/chr” and press the TAB key on your keyboard to make it type the rest.

cp opt/google/chrome/libpdf.so /usr/lib/chromium/

When that’s done, close all your open Chromium browsers (including this one, but remember to head back here to rate the post afterwards :))
Reopen Chromium and type the following in your address bar:

about:plugins

You should now see “Chrome PDF viewer” in the list, like in the picture below:
2014-01-22-094958_378x47_scrot2014-01-22-094958_378x47_scrot

You should now be able to view PDF when clicking on a PDF link in Chromium!

You may delete the files you downloaded and extracted, except for /usr/lib/chromium/libpdf.so.

3 thoughts on “Open PDF with Chromium in Linux using the in-browser PDF viewer

  1. Arlo

    Worked for me on Debian where the web store extension was failing. Thanks for the excellent level of detail.

    Reply
  2. fernandesanto

    Works very well in my case (Cubuntu 14.04 LTS) but the right folder name is :
    cp opt/google/chrome/libpdf.so /usr/lib/chromium-browser/
    Thanks

    Reply

Leave a Reply

Your email address will not be published.