IDE: VS 2022 | .NET 6.0

I'm looking for free .NET library to convert string html to .pdf file. In the web I found PDFSharp, but I have error with it (desc below)

I tried:

nugets: HtmlRenderer.PdfSharp and PDFSharp

I must try PDFsharp combine with other nuget, because PDFsharp does not currently include code to parse HTML files.


using PdfSharp;
using PdfSharp.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;

public class GenerateApiController : Controller

public IActionResult GeneratePdf(Guid guid)

     DateTime dateNow = DateTime.Now;

     string html = $"<div align=right><font size=\"4\"> {dateNow}</div>" +

     PdfDocument pdfDocument = TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(html, PageSize.A4);


     return Ok();


the error occurs when trying to call the method = does not enter the method = I dont have error while compiling, only when trying to call a method


Internal Server Error

FileNotFoundException: Could not load file or assembly 'HtmlRenderer, Version=, Culture=neutral, PublicKeyToken=null'. The specified file could not be found.

In VS 2022 in diagnostic I have message - HtmlRenderer.PdfSharp:

Warning: Package 'HtmlRenderer.PdfSharp' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.

If you have other ideas / nuggets, please help

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jun 22, 2022 at 12:24

1 Answer 1


You can try Syncfusion’s Essential .NET PDF library.

https://www.syncfusion.com/document-processing/pdf-framework/net enter image description here

The whole suite of controls is available for free (commercial applications also) through the community license program if you qualify. The community license is the full product with no limitations or watermarks.


Note: I work for Syncfusion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.