在点击提交按钮下载pdf格式的aspx页面 [英] Download an aspx page in pdf format on click submit button

查看:90
本文介绍了在点击提交按钮下载pdf格式的aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想帮助我开发一个网站,其中一个页面包含一些数据,当点击下载按钮时,使用window.open将操作重定向到另一个页面,因为我设计了一个布局,无需在浏览器中保存保存按钮即可下载内容。实际上,单击浏览器中的保存按钮即可下载。但我不想那样,页面会在我的机器上自动下载。任何人都可以帮助我。预先感谢你。

Hi, I wanna one help i developed one website in that one page is containing some data and when click on the download button that action is redirected to another page by using window.open, in that i have designed one layout and that content can be downloaded without saving the save button in browser. Actually it is downloaded when click on the save button in browser. but i don't want like that, the page automatically download in my machine. can any one help me please. Advancely thank you.

推荐答案

您的问题尚不清楚,但根据您的描述,我可以猜测并为您提供以下两种可能的解决方案。



1.使用Anchor标签并将文件路径提供给锚标签的href属性,如下所示:

Your question is unclear but as per your description I'can guess and provide you following two possible solutions.

1. Use Anchor tag and give the filepath to href attribute of anchor tag, like this:
<a href="yourfilepathfromyourserver.pdf" target="_blank" alt="Download">Download Pdf</a>



这里, target =_ blank 是在新窗口中打开文件的关键。



2.如果你想使用现有格式从asp.net gridview导出数据 [ ^ ],最佳做法是提供按钮onclick事件。


Here, target="_blank" is the key to open file in new window.

2. If you want to export data from asp.net gridview with existing format[^], best practice is to provide a button onclick event.


这是第三方工具,



http://www.essentialobjects.com/Products/EOPdf/ASPXToPDF.aspx [< a href =http://www.essentialobjects.com/Products/EOPdf/ASPXToPDF.aspxtarget =_ blanktitle =New Window> ^ ]
Here is the third party tool for you,

http://www.essentialobjects.com/Products/EOPdf/ASPXToPDF.aspx[^]


如果您希望文件自动下载到客户端,那么您无法执行此操作或安全原因。
If you want the file to automatically download to the client then you can't do that for security reasons.


这篇关于在点击提交按钮下载pdf格式的aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆