Is There a Web Service for Converting HTML to Pdf

Is there a web service for converting HTML to PDF?

For third party solutions there are lots of options. Just to name a few...


A best Html to PDF converter in ASP.NET Core 6.0

You can use Syncfusion to convert html to pdf.

First, Install Syncfusion.HtmlToPdfConverter.Net.Windows NuGet package.

Then, Edit the corresponding method in the controller:

public class HomeController : Controller
public IActionResult Index()
return View();
public IActionResult ExportToPDF()
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();

//Convert URL to PDF document
PdfDocument document = htmlConverter.Convert("");

//Create memory stream
MemoryStream stream = new MemoryStream();

//Save the document

return File(stream.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf, "HTML-to-PDF.pdf");

Don't forget to add the namespace:

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;

Finally, Add the call in Index.cshtml:

Html.BeginForm("ExportToPDF", "Home", FormMethod.Post);
<input type="submit" value="Convert HTML to PDF" style="width:250px;height:27px" />

You can change the URL Page you want to download in the controller method:

PdfDocument document = htmlConverter.Convert("Your Url");

For more details, you can refer to this document.


Yes, it's not actually open source, you need to get a license key to remove it (only 30 days free trial).

Free and effective first choice is actually SelectPDF.

If you really don't want to use it, you can choose the following two:

It's a headless chrome instance which can capture pdfs, and has a nice C# library (Puppeteer Sharp).

This is also a conversion tool used by open source.

Just my opinion, I think the experience of these two is not as good as SelectPDF. Maybe there are other free and up-to-date PDF converters, but I haven't found them and haven't used them.

Wht is the best solution for HTML to PDF (on Azure Web app)

Azure Apps (former WebSites) operate in restricted (partial-trust) environment and wkhtmltopdf.exe (that is internally used by NReco PdfGenerator wrapper) cannot be executed in this case directly from application.


Unfortunately it will not work with Azure WebJobs as well: tasks are executed under the same (limited) environment as WebSites and GDI functions used by wkhtmltopdf are disabled.

If your ASP.NET app uses wkhtmltopdf-based component for PDF generation (doesn't matter how it is invoked - in separate process or as native DLL API) it will work only under Azure WebRole / WorkerRole / VM.

-- update 2017 --

Wkhtmltopdf (and NReco PdfGenerator wrapper) can be used with Azure Apps with VM-based subscription plan (Basic or higher). At least one issue still exists: it seems fonts API is still restricted and custom fonts cannot be rendered to PDF.

Converting HTML files to PDF

The Flying Saucer XHTML renderer project has support for outputting XHTML to PDF. Have a look at an example here.

Related Topics

Leave a reply