如何在asp.net中的按钮上打开pdf文件 [英] how to open a pdf file on a button in asp.net
本文介绍了如何在asp.net中的按钮上打开pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp.net中的按钮上打开pdf文件
解决方案
在按钮上单击
Response.Redirect(" );
您需要将PDF文件发送到客户端浏览器,请参见此处:
http://stackoverflow.com/questions/736106/asp-net-sending-pdf-到浏览器 [ ^ ]
> http://stackoverflow.com/questions/5586772/asp-net-向用户发送pdf [ ^ ]
只需在查询字符串中传递您的路径即可.
然后在button_Click事件上复制此代码
字符串 filePath = Request.QueryString [" ].ToString(); Response.ContentType = " ; Response.WriteFile(filePath);
how to open a pdf file on a button in asp.net
解决方案
On button click
Response.Redirect("yourpdffile.pdf");
You need to send the PDF file to the client browser, see here:
http://stackoverflow.com/questions/736106/asp-net-sending-pdf-to-browser[^]
http://stackoverflow.com/questions/5586772/asp-net-sending-a-pdf-to-the-user[^]
Just pass your path in query string.
and on button_Click event copy this code
string filePath = Request.QueryString["FILEPATH"].ToString(); Response.ContentType = "application/pdf"; Response.WriteFile(filePath);
这篇关于如何在asp.net中的按钮上打开pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文