简体   繁体   中英

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?

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM