在Web应用程序中将文档另存为.pdf [英] saving document as .pdf in web application
本文介绍了在Web应用程序中将文档另存为.pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
i我在网站上生成发票,我可以用javascript打印。
现在我想要另一种选择,如果我点击导出为pdf(按钮)的按钮,它应保存为pdf或它应该在计算机上以pdf格式下载。有没有办法做到这一点。
谢谢。
解决方案
Response.Buffer = true ;
Response.Clear();
// Response.Charset =Unicode;
Response.ContentType = mimeType;
Response.ContentType = application / pdf;
Response.AddHeader( content-disposition, attachment; filename = + invoice.pdf跨度>);
Response.BinaryWrite(bytes); // 创建文件
Response.Flush();
Hello
i am generating an invoice in website, i can print it using javascript.
Now i want another option, if i click on the button export as pdf(BUTTON), it should save as pdf or it should get downloaded as pdf on computer,. Is there any wayto do this.
Thanks.
解决方案
Response.Buffer = true; Response.Clear(); //Response.Charset = "Unicode"; Response.ContentType = mimeType; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment; filename=" + "invoice.pdf"); Response.BinaryWrite(bytes); // create the file Response.Flush();
这篇关于在Web应用程序中将文档另存为.pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文