Convert HTML to PDF in .NET

后端 未结 30 1867
不知归路
不知归路 2020-11-22 00:28

I want to generate a PDF by passing HTML contents to a function. I have made use of iTextSharp for this but it does not perform well when it encounters tables and the layout

30条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 00:39

    Try this PDF Duo .Net converting component for converting HTML to PDF from ASP.NET application without using additional dlls.

    You can pass the HTML string or file, or stream to generate the PDF. Use the code below (Example C#):

    string file_html = @"K:\hdoc.html";   
    string file_pdf = @"K:\new.pdf";   
    try   
    {   
        DuoDimension.HtmlToPdf conv = new DuoDimension.HtmlToPdf();   
        conv.OpenHTML(file_html);   
        conv.SavePDF(file_pdf);   
        textBox4.Text = "C# Example: Converting succeeded";   
    }   
    

    Info + C#/VB examples you can find at: http://www.duodimension.com/html_pdf_asp.net/component_html_pdf.aspx

提交回复
热议问题