0

I need to convert html file(report.html) that I create to PDF,

I tried:

PdfDocument pdf = PdfGenerator.GeneratePdf(htmlFilePath, PageSize.A4);
pdf.Save(pdfFileName);

But without success. Should I close chrome driver before I start creating PDF or is my code wrong?

Error message: Could not load file or assembly 'HtmlRenderer, Version=1.5.0.5, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

I send same htmlFilePath as for creating HTML.

2 Answers2

0

You must see warning list(not error list). In my case I can not use .net framework dll in .netcore project.

my warning list has one warning about that:

Warning NU1701 Package 'HtmlRenderer.Core 1.5.0.5' 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 '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.

Ali Rasouli
  • 1,705
  • 18
  • 25
-1

Problem was with nuget, when i reference one project that have HtmlRenderer to another HtmlRenderer.dll was not copied.

Now i have other problem PDF generate only path of html file. enter image description here