0

When I use <iframe src="some_pdf_file.pdf/> on a PDF that has the header Content-Disposition set to attachment the iframe decides to download the file instead of rendering it. This is reasonable behavior, however I want to force the PDF to be rendered in the iframe.

How can I do this? Is it possible to download the file and then change the Content-Disposition header to inline?

<object
  data='https://pdfjs-express.s3-us-west-2.amazonaws.com/docs/choosing-a-pdf-viewer.pdf'
  type="application/pdf"
  width="500"
  height="678"
>
  <iframe
    src='https://pdfjs-express.s3-us-west-2.amazonaws.com/docs/choosing-a-pdf-viewer.pdf'
    width="500"
    height="678"
  >
    <p>This browser does not support PDF!</p>
  </iframe>
</object>
Magnuti
  • 63
  • 9
  • Possible duplicate of https://stackoverflow.com/questions/11850298/how-can-i-force-a-browser-to-not-download-a-file-with-content-dispositionattach – Magnuti Nov 29 '21 at 12:34
  • @KJ your comment does not contribute anything to answering the original question. – Magnuti Dec 01 '21 at 08:41

0 Answers0