3

Firefox's built in PDF viewer (PDF.js) has an issue with saving PDF files using the URL as a guide (thus saving them with a .aspx extension than a .pdf one). Has anyone found a temporary workaround on the server side to keep users from using PDF.js or forcing the download (Save As) button to save using the .pdf extension? I'd like the user to be able to view within the browser, and save as a pdf. I know of workarounds on the client side (switching to the adobe plugin for example), but I'm not interested in such a solution.

For more information, please see the referenced issues at the bottom of https://github.com/mozilla/pdf.js/pull/2635. It appears that a fix was created, but it hasn't been included in Firefox as of version 20.0.1. PDF.js was introduced in Firefox v19.

Mr Watkins
  • 31
  • 1
  • possible duplicate of [How to disable Firefox default PDF viewer / Plugin using asp.net?](http://stackoverflow.com/questions/15609086/how-to-disable-firefox-default-pdf-viewer-plugin-using-asp-net) – yms Apr 16 '13 at 14:28
  • 1
    It looks like things have been fixed, but you must include the proper header: Response.AddHeader("Content-Disposition","inline; filename=blah.pdf") Also make sure you don't close the response before the you Response.End(). Chrome doesn't like that. – Mr Watkins Apr 17 '13 at 17:37
  • For people running across this question who are looking to EMBED PDF documents while ignoring the PDF.JS, check my answer here: http://stackoverflow.com/a/26903042/942841 – Andrew Bucklin Nov 13 '14 at 07:01

1 Answers1

0

You need to set proper header:

Automatically open PDF

Content-Type: application/pdf

Ask user action

Content-Type: application/octet-stream; Content-Disposition: attachment