Han Kun
Han Kun

Reputation: 83

Open downloaded file (PDF) in specific program (Adobe Reader)

I create PDF files on my server (Java servlet). In the (JSP) home screen, there's a button that when clicked should have the client open the PDF file (downloaded from server) with Adobe Reader.

How to call exactly Adobe Reader to open that PDF file?

Upvotes: 0

Views: 1401

Answers (1)

Sid
Sid

Reputation: 523

If you have Adobe Reader as the default application to handle pdf files on the OS. Set the response HTTP header Content-Disposition this will force the browser to download the file instead of opening it within the browser. This way opening the downloaded PDF will open on Adode Reader.

response.setContentType("application/pdf"); 
response.setHeader("Content-Disposition", "attachment; filename=downloaded.pdf");

Upvotes: 1

Related Questions