简体   繁体   English

下载以HTML格式生成的iext PDF

[英]Download itext generated PDF in html

I am trying to download pdf file generated by itext. 我正在尝试下载由itext生成的pdf文件。

In my application, jquery, rest web service is being used. 在我的应用程序jquery中,正在使用rest Web服务。

As of now, i am able to create pdf file at server side but facing issue while sending to html. 截至目前,我能够在服务器端创建pdf文件,但在发送到html时遇到问题。

I have tried below links with no success. 我尝试了以下链接,但均未成功。

iTextSharp generated PDF: How to send the pdf to the client and add a prompt? iTextSharp生成的PDF:如何将pdf发送给客户端并添加提示?

Download pdf file using jquery ajax 使用jquery ajax下载pdf文件

When i see in developer tool, i can see below data in response of ajax request. 当我在开发人员工具中看到时,我可以看到以下响应ajax请求的数据。

Block quote%PDF-1.4 % 3 0 obj <>stream x |E ... 块引用%PDF-1.4% 3 0 obj <> streamx |E ...

Block quote 块报价

Are you creating it in memory or creating a file on server. 您是在内存中创建它还是在服务器上创建文件。 There are number of methods to do this. 有许多方法可以做到这一点。 Either you can manipulate the headers and pass in the response. 您可以操纵标题并传递响应。 Create a file on server and pass the file url in response and open it in new tab. 在服务器上创建一个文件,然后传递文件URL作为响应,然后在新选项卡中将其打开。 It depends on which language you are doing. 这取决于您使用哪种语言。 Handle file download from ajax post 处理从ajax发布的文件

Content-Type: application/octet-stream
Content-Disposition: attachment; filename="somefile.pdf"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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