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.

3 Answers3

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,423
  • 17
  • 21
-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

-4

HTML to PDF Converter supports the following features:

Hyperlinks (internal and external) in generated PDF document. When clicked on an internal link in the generated PDF file, the document would jump to the target location within the same PDF file.

Security permissions and password protection.

Set paper size, orientation and margins for PDF output.

Embedded fonts.

Unicode support.

Right-to-left and mix/latin text.

Fonts, point-size, various character styles and colors.

Paragraph formatting features such as centering, justification, indentation, etc. Complex elements such as tables, nested tables, etc.

Cascading stylesheet.

Support for PNG, JPEG, WMF, EMF, GIF, and WMF picture formats.

Creates PDF bookmarks for HTML Heading tags.

Support for multithreaded applications.

The Web Browser mode supports all html formatting features supported by IE.