Skip to main content
Inspiring
Jul 11, 2016 6:40 PM UTC
Question

do not want PDF to open in browser

would like to make link to PDF automatically open the 'save as' window and/or auto-download to user's computer.

form fields are not displaying in certain browsers.

How can I do this? Thank you!

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

NKOWA555
Inspiring
Jul 12, 2016 1:41 AM UTC

You would have to do this with a server-side script; such as, PHP or ASP.net; but, it depends on your server's OS language

Example: ASP.net (C#):

try {

  Response.ContentType = "application/pdf";

  Response.AddHeader("content-disposition", "attachment; filename=" + FileName);

  Response.WriteFile(FilePath);

  Response.End();

} catch (Exception Ex) {

  Err.Clear();

}

Translate
r_tistAuthor
Inspiring
Jul 12, 2016 4:01 PM UTC

can PDF somehow have a popup overlay when opened in a browser that prompts user to save and print, especially if a real signature is needed?

Translate
try67
Community Expert
Community Expert
Jul 11, 2016 6:51 PM UTC

You can't. It's up to the user how the file is going to be opened/viewed on their machine. The best you can do it recommend to them to save it instead of opening it inside their browser window (or you could place the file in a zip archive, to force them to first save it locally and only then open it).

Translate
r_tistAuthor
Inspiring
Jul 11, 2016 7:23 PM UTC

OK, thanks for the options.

Translate