如何将HTML导出为PDF [英] How to Export HTML to PDF

查看:151
本文介绍了如何将HTML导出为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在开发一个将所有html conetents导出为pdf的应用程序。

我发现很少有像itextsharp这样的第三方库。

但是它们都没有100%工作。



那么任何人都可以帮助我实现这种导出HTML到PDF的功能吗?

它应该支持css,图像和所有内容。

Hi,

I am developing an application to export all the html conetents to pdf.
I found few third party libraries like itextsharp and all.
But none of them work 100%.

So can any one help me to achieve this export HTML to PDF functionality ?
It should support css, images and everything.

推荐答案

iTextSharp [ ^ ]是一个强大的实用程序,可以帮助您生成pdf。
iTextSharp[^] is a powerful utility that can help you generate a pdf.


您好,



您可以查看以下网址



http://www.codeproject.com/KB/cs/pdfizer.aspx



如果你愿意使用溢价服务然后你也可以查看这些



EOpdf或Asppdf.net



或者您可以查看以下内容以及



ASP.NET中的一体化导出数据 [ ^ ]





从中生成PDF文档使用ASP.NET的HTML页面 [ ^ ]





http://csharpdotnetfreak.blogspot.in/2008/12/export-gridview-to-pdf-using-itextsharp。 html [ ^ ]





如果有帮助请告诉我。



快乐编程
Hi,

You can review the following URL

http://www.codeproject.com/KB/cs/pdfizer.aspx

And if you are willing to use the premium service then you can also review these

EOpdf or Asppdf.net

Or you can review the followings as well

All in One Export Data in ASP.NET[^]


Generate PDF documents from a HTML page using ASP.NET[^]


http://csharpdotnetfreak.blogspot.in/2008/12/export-gridview-to-pdf-using-itextsharp.html[^]


Please let me know if that helps.

Happy Programming






无论你想要什么,首先谷歌它。在谷歌他们是这么多链接相关..



请检查此链接...



使用c#进行HTML到PDF的转换 [ ^ ]

http://www.dotnetfunda.com/forums/thread3134 -html-table-export-to-pdf-using-csharp.aspx [ ^ ]

http://stackoverflow.com/questions/564650/convert-html-to-pdf-in-net [ ^ ]



这可能对你有帮助....





如果你想要相关的代码,请查看这个..



Hi,

Whatever you want first Google it. In google they are so many links related to this..

Please check this links...

Html to PDF conversion using c#[^]
http://www.dotnetfunda.com/forums/thread3134-html-table-export-to-pdf-using-csharp.aspx[^]
http://stackoverflow.com/questions/564650/convert-html-to-pdf-in-net[^]

this might be helpfull to you....


If you want code related this please check with this..

protected void btnExportToPDF_Onclick(object sender, EventArgs e)
      {
          Response.ClearContent();
          Response.ContentType = "application/pdf";
          Response.AddHeader("content-disposition", "attachment;filename=ExportPDF.pdf");
          Response.Cache.SetCacheability(HttpCacheability.NoCache);
          StringWriter sw = new StringWriter();
          HtmlTextWriter hw = new HtmlTextWriter(sw);

          Table3.RenderControl(hw);
          lblMessbody.RenderControl(hw);
          StringReader sr = new StringReader(sw.ToString());
          Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
          HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
          PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
          pdfDoc.Open();
          htmlparser.Parse(sr);
          pdfDoc.Close();
          Response.Write(pdfDoc);
          Response.End();

      }


这篇关于如何将HTML导出为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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