Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF downloading directly in Google Chrome -- how to display in browser window instead? [closed]

I have been using Google Chrome and recently I have re-installed my browser.

I found that whatever PDF links I open are directly downloading. However, I want them to be view on browser.

How can I do this?

Chrome is an updated version.

like image 526
S K padala Avatar asked Apr 13 '15 06:04

S K padala


People also ask

How do I get Chrome to open PDF in browser instead of download?

Select Site Settings. Scroll down through the Permissions list of options and select PDF documents. Use the toggle switch next to Download PDF files instead of automatically opening them in Chrome to turn the feature on or off.

How do I display PDF in browser instead of downloading?

At the top right, click More Settings. At the bottom, click Show advanced settings. Under “Privacy”, click Content settings. Under “PDF Documents," check the box next to "Open PDF files in the default PDF viewer application.” (Uncheck this box if you want PDFs to open automatically when you click them.)

How do I force a file to open in browser instead of downloading Chrome?

To make certain file types OPEN on your computer, instead of Chrome Downloading... You have to download the file type once, then right after that download, look at the status bar at the bottom of the browser. Click the arrow next to that file and choose "always open files of this type". DONE.


1 Answers

For Chrome to open a PDF inline, in the browser window itself, several requirements have to be met, one for the browser itself, the other for the remote server offering the PDF:

  1. There must be a PDF viewer enabled for Chrome, either the external PDF.js one from Mozilla, or the native, builtin Chrome PDF viewer called pdfium (there are other plugins, such as the proprietary ones from Adobe Acrobat or from Foxit which can be used, but I don't discuss these in this answer):

    • In recent Chrome versions, the 'pdfium' viewer should be included automatically. To check if it is enabled, type about:plugins into the URL bar. Search for 'Chrome PDF Viewer'. It should not be disabled.
    • To check for 'PDF.js', type about:extensions into the URL bar. Search for 'pdf.js'. If you find it, enable the checkmark. If you do not find it, it is not installed.

    Note, that you can only enable one of these two internal PDF viewers.

  2. The remote server providing the PDF document to your browser needs to send the correct MIME type and the correct content disposition header, otherwise the browser will not open the PDF directly, but only save it (or offer to save it):

    • the HTTP header needs to be: Content-Disposition: Inline (not: Content-Disposition: Attachment!)
    • the MIME type needs to be: application/pdf (not: application/octet-stream!). It may be the case that it also works for text/html but I haven't checked this.

As an additional measure, please also open chrome://flags, search for 'pdf' and see if there is a suspicious setting which may prevent the direct rendering of PDFs in the browser window.

like image 135
Kurt Pfeifle Avatar answered Sep 20 '22 16:09

Kurt Pfeifle