如何在ASP.NET中将网页转换为PDF?

时间:2022-10-30 14:31:06

I have a webpage with some data in a table and I would like to offer my users the option to download it as a PDF File, how can I do that in ASP.Net?

我有一个表格中有一些数据的网页,我想为我的用户提供将其下载为PDF文件的选项,我该如何在ASP.Net中执行此操作?

5 个解决方案

#1


Take a look at the iTextSharp library.

看看iTextSharp库。

#2


wkhtmltopdf works great and uses the webkit rendering engine (Safari, Chrome) instead of a cooked up html/css parser.

wkhtmltopdf效果很好,使用webkit渲染引擎(Safari,Chrome)而不是熟练的html / css解析器。

The benefit is that you simply give it your url and it returns a pdf. You would just need to make a printer friendly version of the page to send to it.

好处是你只需给它你的网址,它返回一个pdf。您只需要打印一个打印机友好版本的页面即可发送给它。

#3


  1. You can use a report generator like sql report or crystal report to generate the pdf file.
  2. 您可以使用报告生成器(如sql report或crystal report)生成pdf文件。

  3. You can use third party pdf generate tool , and use it to generate a pdf in memory, and sent it to client use Response.Write.
  4. 您可以使用第三方pdf生成工具,并使用它在内存中生成pdf,并将其发送给客户端使用Response.Write。

#4


You can also use the MS ReportViewer control and render your PDF from code if you don't want the actual viewer on the page.

如果您不希望页面上有实际的查看器,您还可以使用MS ReportViewer控件并从代码中呈现PDF。

#5


If you are using asp.net mvc and want to convert result from mvc views into pdf. You can look at this blog post.

如果您正在使用asp.net mvc并希望将mvc视图的结果转换为pdf。你可以看一下这篇博文。

If you are considering to print complex pdf reports from c#. You can check out this blog post.

如果您正在考虑从c#打印复杂的pdf报告。你可以查看这篇博文。

Disclaimer: I am the author of jsreport.

免责声明:我是jsreport的作者。

#1


Take a look at the iTextSharp library.

看看iTextSharp库。

#2


wkhtmltopdf works great and uses the webkit rendering engine (Safari, Chrome) instead of a cooked up html/css parser.

wkhtmltopdf效果很好,使用webkit渲染引擎(Safari,Chrome)而不是熟练的html / css解析器。

The benefit is that you simply give it your url and it returns a pdf. You would just need to make a printer friendly version of the page to send to it.

好处是你只需给它你的网址,它返回一个pdf。您只需要打印一个打印机友好版本的页面即可发送给它。

#3


  1. You can use a report generator like sql report or crystal report to generate the pdf file.
  2. 您可以使用报告生成器(如sql report或crystal report)生成pdf文件。

  3. You can use third party pdf generate tool , and use it to generate a pdf in memory, and sent it to client use Response.Write.
  4. 您可以使用第三方pdf生成工具,并使用它在内存中生成pdf,并将其发送给客户端使用Response.Write。

#4


You can also use the MS ReportViewer control and render your PDF from code if you don't want the actual viewer on the page.

如果您不希望页面上有实际的查看器,您还可以使用MS ReportViewer控件并从代码中呈现PDF。

#5


If you are using asp.net mvc and want to convert result from mvc views into pdf. You can look at this blog post.

如果您正在使用asp.net mvc并希望将mvc视图的结果转换为pdf。你可以看一下这篇博文。

If you are considering to print complex pdf reports from c#. You can check out this blog post.

如果您正在考虑从c#打印复杂的pdf报告。你可以查看这篇博文。

Disclaimer: I am the author of jsreport.

免责声明:我是jsreport的作者。