超链接可以在ASP.NET中打印PDF文件

问题描述:

我在服务器上的文件夹中有一个pdf文件。我希望用户能够打印pdf文件而不是下载它。我有一个超链接到位。我希望用户点击超链接和pdf打印。我怎样才能使这个工作?

I have a pdf file in a folder on the server. I want the user to be able to print the pdf file not download it. I have a hyperlink in place. I want the user to click on the hyperlink and the pdf prints. How can I get this to work?

我可以想到几个选项:



- 您将PDF导出/转换为几个图像文件,然后将它们放入隐藏的iframe并使用window.print()打印iframe内容



- 或者您将PDF显示在iframe中,该iframe指向Google Doc Viewer,它将PDF作为图像文件免费呈现。 不使用Acrobat的PDF查看器 [ ^ ]

注意您的PDF需要公开访问,因为您需要将其传递给Google以执行其工作



- 最后一个选项不是免费的,不确定它是否值得您的案例 http://goo.gl/OLPha [ ^ ]
I can think of a couple of options:

- You export/convert the PDF to a couple of image files, then you place them into a hidden iframe and use window.print() to print the iframe content

- Or you display the PDF into an iframe which points to Google Doc Viewer which will render your PDF as image files for free. PDF viewer without using Acrobat[^]
Note that your PDF needs to have public access as you need to pass it to Google for doing its job

- The last option is not free and not sure if it's worth in your case http://goo.gl/OLPha[^]