View pdf file in browser instead of downloading View pdf file in browser instead of downloading codeigniter codeigniter

View pdf file in browser instead of downloading


You need to change the Content-disposition to inline.

Change

header("Content-disposition: attachment;     filename=".basename('theme/assets/pdf/ci.pdf'));

To:

header("Content-disposition: inline;     filename=".basename('theme/assets/pdf/ci.pdf'));


Downloading or Opening of a PDF file depends on setting in the browser.

Browser Setting to Open the PDF File instead of download:

Open PDFs in ChromeOn your computer, open Chrome.At the top right, click More Settings.At the bottom, click Advanced.Under "Privacy and security," click Content settings.Near the bottom, click PDF documents.Turn off Download PDF files instead of automatically opening them in Chrome.

Setting in Mozilla Firefox

  1. Click on Extreme Right 3 lines.
  2. Click on Options
  3. In General Selection go to Applications
  4. Set for PDF File as "Preview in Firefox"