Generate PDF based on HTML code (iTextSharp, PDFSharp?)

前端 未结 10 2090
南笙
南笙 2020-12-08 08:15

Does the library PDFSharp can - like iTextSharp - generate PDF files *take into account HTML formatting *? (bold (strong), spacing

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 08:54

    I'll recommend you NReco.PdfGenerator because have free and paid license and its easy to install from nuget.

    Main page: https://www.nrecosite.com/pdf_generator_net.aspx

    Documentation: https://www.nrecosite.com/doc/NReco.PdfGenerator/

    If you want create PDF from html file try:

    String html = File.ReadAllText("main.html");
    var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
    htmlToPdf.GeneratePdf(html, null, "C:/Users/Tmp/Desktop/mapa.pdf");
    

提交回复
热议问题