Chromium downloads all PDF files initially instead of of opening them within the browser

6,426

Solution 1

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.

Solution 2

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:
6,426

Related videos on Youtube

asood91
Author by

asood91

Updated on September 18, 2022

Comments

  • asood91
    asood91 almost 2 years

    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?

    • AzkerM
      AzkerM over 10 years
      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
  • Radu Rădeanu
    Radu Rădeanu over 10 years
    Nice trick to steal from Google Chrome ;)
  • terdon
    terdon over 10 years
    @RaduRădeanu thanks :) I got the idea from here.
  • terdon
    terdon over 10 years
    @Guru my chromium does not come with libdf.so, which version are you using? Does it contain a libdf.so file?
  • terdon
    terdon over 10 years
    @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.