[英]Open downloaded file (PDF) in specific program (Adobe Reader)
I create PDF files on my server (Java servlet). 我在服务器(Java Servlet)上创建PDF文件。 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. 在(JSP)主屏幕中,有一个按钮,单击该按钮后,客户端应使用Adobe Reader打开PDF文件(从服务器下载)。
How to call exactly Adobe Reader to open that PDF file? 如何准确调用Adobe Reader打开该PDF文件?
If you have Adobe Reader as the default application to handle pdf files on the OS. 如果您将Adobe Reader作为默认应用程序来处理OS上的pdf文件。 Set the response HTTP header Content-Disposition this will force the browser to download the file instead of opening it within the browser. 设置响应HTTP标头Content-Disposition,这将强制浏览器下载文件,而不是在浏览器中打开文件。 This way opening the downloaded PDF will open on Adode Reader. 这样打开下载的PDF即可在Adode Reader中打开。
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=downloaded.pdf");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.