Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Whenever I click on a link which contain a PDF file, Chromium automatically downloads the file. Instead, I would like to open it for my viewing rather than downloading it.

How can I achieve this?

share|improve this question
1  
Open a new-tab & type chrome://plugins/, then check whether inbuilt Chrome PDF Viewer is enabled. Also go to setting > Show advanced settings... & click content setting under privacy, then refer to plug-ins whether it is set to run automatically –  AzkerM Mar 8 at 19:46

2 Answers 2

You have two main options:

  1. Install an extension. For example this one: Docs PDF/PowerPoint Viewer (by Google) which lets you view PDFs in Google Docs.

  2. While chromium does not provide this, chrome does, so you can steal it from there. First, download the chrome .deb:

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

    Or, if you are running a 32bit system:

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

    Now, extract libpdf.so from the file you downloaded. I don't use Unity but I believe you can do this using by right clicking the file and choosing Open With => File Roller or Archive Manager or similar. From the terminal you can do:

    dpkg -x google-chrome-stable_current_amd64.deb ./ && 
    cp ./opt/google/chrome/libpdf.so . && rm -rf etc opt usr
    

    That will unpack the .deb, copy libpdf.so to the current directory and delete the unpacked data. You can now copy libpdf.so to /usr/lib/chromium-browser/:

    sudo cp libpdf.so /usr/lib/chromium-browser/
    

    Now restart your chromium and you should be able to view PDF files.

share|improve this answer
    
Nice trick to steal from Google Chrome ;) –  Radu Rădeanu Mar 8 at 20:11
    
@RaduRădeanu thanks :) I got the idea from here‌​. –  terdon Mar 8 at 20:18
    
@Guru my chromium does not come with libdf.so, which version are you using? Does it contain a libdf.so file? –  terdon Mar 8 at 20:38
    
@Guru then why are you suggesting using an extension in your answer? Do you mean that it's working fine if you have the extension installed? Of course it does. My answer explains how to do it natively in chromium, in the same way as chrome does it. –  terdon Mar 8 at 20:42
    
@Guru edited, thanks :). –  terdon Mar 8 at 20:47

Install Docs PDF/PowerPoint Viewer in chromium.

It will let you open pdf file in browser. You can also download those file if you wish.

By clicking on a link for a supported document format you'll be taken to the Google Docs Viewer. On the options page you can also disable any file formats you don't want to use the Viewer for.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.