A wkhtmltopdf alternative for .NET
ExpertPdf is a .NET HTML to PDF library you call directly from C#, VB.NET, ASP.NET, ASP.NET MVC and ASP.NET Core code. .NET developers use it in place of wkhtmltopdf when they want a maintained, supported component instead of an external command-line tool.
Why look for a wkhtmltopdf alternative?
wkhtmltopdf is a free, open-source command-line tool that renders HTML to PDF with an older, patched QtWebKit engine. Its source repository was archived in January 2023 and the project is no longer maintained, so it no longer receives bug fixes or security updates. To use it from .NET you also have to run its executable, or rely on a third-party wrapper, instead of calling a .NET API.
ExpertPdf and wkhtmltopdf compared
Migrating from wkhtmltopdf
Replace the command-line call with a few lines of code. Page size, orientation, margins, headers and footers are converter properties; page breaks follow your CSS.
// Before: run wkhtmltopdf and wait for the file // Process.Start("wkhtmltopdf", "--page-size A4 https://www.example.com/ page.pdf"); // After: call the library using ExpertPdf.HtmlToPdf; var converter = new PdfConverter(); converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4; byte[] pdf = converter.GetPdfBytesFromUrl("https://www.example.com/");
Moving from wkhtmltopdf: questions
Is wkhtmltopdf still maintained?
How hard is it to move from wkhtmltopdf to ExpertPdf?
PdfConverter, set the page options and call GetPdfBytesFromUrl or GetPdfBytesFromHtmlString. Headers, footers and page breaks are set with properties and CSS.Do I need to deploy an executable?
Can I try it with my own HTML first?
Replace wkhtmltopdf with a .NET library.
Download the free evaluation with C# and VB.NET samples for ASP.NET, ASP.NET MVC, ASP.NET Core and Windows Forms.