User click on a link button and it will direct them to a url that is dynmaically generated which a pdf file. The browser will prompt the user to either save or open it.
用户单击链接按钮,它将指向一个动态生成的PDF文件的URL。浏览器将提示用户保存或打开它。
I want to know if it is possible to downlaod the pdf file to the server then show the pdf file in the asp.net web page. When i google on this question, 99% of top link are some third party component. Is it a way to do this without purchase any 3rd party component?
我想知道是否可以将pdf文件下载到服务器然后在asp.net网页中显示pdf文件。当我在这个问题谷歌时,99%的*链接是一些第三方组件。是否可以在不购买任何第三方组件的情况下执行此操作?
thank
6 个解决方案
#1
I use itextsharp, its a free open source c# port of the java itext library.
我使用itextsharp,它是java itext库的免费开源c#端口。
Makes generating dynamic pdfs in asp.net a breeze and there is lots of documentation/examples floating around.
在asp.net中生成动态pdf变得轻而易举,并且有很多文档/示例浮动。
#2
I don't think that you'll have much luck without a 3rd party component. First, the issue isn't showing the PDF, it is generating it. For that, you'll need a library to help. Rolling one yourself would not be cheaper unless you have an enormous amount of unpaid time on your hands.
如果没有第三方组件,我认为你没有多少运气。首先,问题不是显示PDF,而是生成它。为此,您需要一个库来帮助。除非你手上有大量的无薪时间,否则自己滚动一个并不便宜。
With respect to third-party controls, I recommend and use DynamicPDF from CeTe.
关于第三方控件,我推荐并使用CeTe的DynamicPDF。
#3
Yes there is a way to do this without a 3rd party tool, but it involves coding a PDF-to-html translator.
是的,有一种方法可以在没有第三方工具的情况下执行此操作,但它涉及编码PDF到HTML的翻译器。
If this is something for a business, the RoI for the 3rd party control is that you don't have to spend hundreds of hours coding & testing this component, when you could buy one for just a few hundred dollars.
如果这是针对企业的,那么第三方控制的RoI就是你不需要花费数百小时来编写和测试这个组件,当你只需花几百美元购买一个。
Now, an alternative is to code a page which displays the data in the same way which the PDF file generates it (this could actually be handled by RDLC). So that when the user clicks the link button, they are taken to this display page, from which they can download the PDF version if they want a local copy.
现在,另一种方法是编写一个页面,该页面以与PDF文件生成数据相同的方式显示数据(这实际上可以由RDLC处理)。因此,当用户单击链接按钮时,他们将被带到此显示页面,如果他们想要本地副本,他们可以从中下载PDF版本。
#4
Regardless of how you generate the PDF, I have found a better user experience if you open the PDF in an IFRAME instead of the full browser window. You can give users instructions and maintain the browser navigation.
无论您如何生成PDF,如果您在IFRAME而不是完整的浏览器窗口中打开PDF,我都会找到更好的用户体验。您可以向用户提供说明并维护浏览器导航。
#5
I think what you want to do is by going to: http://my_site.com/generate-pdf.aspx?=someId this should in fact just show the PDF file? What you need to do is change the Response type.
我想你想要做的是访问:http://my_site.com/generate-pdf.aspx?= someId这实际上应该只显示PDF文件?您需要做的是更改响应类型。
See here for how to do this with images.
请参阅此处了解如何使用图像执行此操作。
#6
Look up the Content-Disposition HTTP header. You can send back a value that requests the content be displayed inline instead of downloaded.
查找Content-Disposition HTTP标头。您可以发回一个值,请求内容显示内联而不是下载。
#1
I use itextsharp, its a free open source c# port of the java itext library.
我使用itextsharp,它是java itext库的免费开源c#端口。
Makes generating dynamic pdfs in asp.net a breeze and there is lots of documentation/examples floating around.
在asp.net中生成动态pdf变得轻而易举,并且有很多文档/示例浮动。
#2
I don't think that you'll have much luck without a 3rd party component. First, the issue isn't showing the PDF, it is generating it. For that, you'll need a library to help. Rolling one yourself would not be cheaper unless you have an enormous amount of unpaid time on your hands.
如果没有第三方组件,我认为你没有多少运气。首先,问题不是显示PDF,而是生成它。为此,您需要一个库来帮助。除非你手上有大量的无薪时间,否则自己滚动一个并不便宜。
With respect to third-party controls, I recommend and use DynamicPDF from CeTe.
关于第三方控件,我推荐并使用CeTe的DynamicPDF。
#3
Yes there is a way to do this without a 3rd party tool, but it involves coding a PDF-to-html translator.
是的,有一种方法可以在没有第三方工具的情况下执行此操作,但它涉及编码PDF到HTML的翻译器。
If this is something for a business, the RoI for the 3rd party control is that you don't have to spend hundreds of hours coding & testing this component, when you could buy one for just a few hundred dollars.
如果这是针对企业的,那么第三方控制的RoI就是你不需要花费数百小时来编写和测试这个组件,当你只需花几百美元购买一个。
Now, an alternative is to code a page which displays the data in the same way which the PDF file generates it (this could actually be handled by RDLC). So that when the user clicks the link button, they are taken to this display page, from which they can download the PDF version if they want a local copy.
现在,另一种方法是编写一个页面,该页面以与PDF文件生成数据相同的方式显示数据(这实际上可以由RDLC处理)。因此,当用户单击链接按钮时,他们将被带到此显示页面,如果他们想要本地副本,他们可以从中下载PDF版本。
#4
Regardless of how you generate the PDF, I have found a better user experience if you open the PDF in an IFRAME instead of the full browser window. You can give users instructions and maintain the browser navigation.
无论您如何生成PDF,如果您在IFRAME而不是完整的浏览器窗口中打开PDF,我都会找到更好的用户体验。您可以向用户提供说明并维护浏览器导航。
#5
I think what you want to do is by going to: http://my_site.com/generate-pdf.aspx?=someId this should in fact just show the PDF file? What you need to do is change the Response type.
我想你想要做的是访问:http://my_site.com/generate-pdf.aspx?= someId这实际上应该只显示PDF文件?您需要做的是更改响应类型。
See here for how to do this with images.
请参阅此处了解如何使用图像执行此操作。
#6
Look up the Content-Disposition HTTP header. You can send back a value that requests the content be displayed inline instead of downloaded.
查找Content-Disposition HTTP标头。您可以发回一个值,请求内容显示内联而不是下载。