This project is read-only.

PdfGenerator produces PDF by HTML in .NET projects

PdfGenerator is a .NET wrapper for WkHtmlToPdf tool that generates high-quality PDF documents from HTML pages. WkHtmlToPdf is based on WebKit engine and resulting PDF in most cases is identical to HTML web browser view.

  • supports custom page size, orientation, margins, cover page and autogenerated table-of-contents.
  • header/footer also defined with HTML. It is possible to use special tokens for page numbers / total number of pages / section title.
  • friendly deployment: all in one DLL (no external dependencies, wkhtmltopdf is embedded as assembly resource and automatically extracted on first use)
  • can be used from ASP.NET server code, Azure WebRole / WorkerRole
    • Azure Apps (WebSites) / WebJobs are not supported at this moment (because of GDI usage limitations)
  • one PDF can be generated from several HTML pages
  • can be used for generating watermarked and secured (password protected) PDFs
  • PdfGenerator LT build can be used in .NET Core projects

Convert HTML to PDF with one line of C# code

  1. install NReco.PdfGenerator nuget package
  2. var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
    var pdfBytes1 = htmlToPdf.GeneratePdf(htmlContent);
    var pdfBytes2 = htmlToPdf.GeneratePdfFromFile("");

    Similar components:

Last edited Apr 12, 2017 at 1:26 PM by fedorchenko, version 12