Sicos1977 / ChromiumHtmlToPdf

Convert HTML to PDF with a Chromium based browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dependency packages?

nickalbrecht opened this issue Β· comments

Just looking at an initial mockup of replacing WkHtmlToPdf in an active project of mine, with ChromeHtmlToPdf instead. But there's a lot of dependent packages that I wasn't expecting, so I went digging through code 😁

Is System.Management needed for something I'm just not seeing?

It looks like the project could be split into two parts, one for prepping the HTML (or the HTML file as most of these look to be dependent on) before being sent to Chrome, and another (the main ChromeHtmlToPdf one) to actually deal with Chrome and outputting a PDF. I'm only glancing through the code but I'm wondering if this could be loosened up so that it's not so tightly coupled to the HTML/file prep that's baked in here, and allow for a more generic way to prep the HTML however is desired. Whether that be nothing at all (which seems to be the case when passing raw HTML string?), or opting into the things this adds when using an Uri, like the HtmlSanitize, FitPageToContent, ImageResize, ImageRotate, etc. Is my assumption correct, that doing this would eliminate the need for AngleSharp, HtmlSanitizer and System.Drawing? I was just surprised when I saw the list of dependencies this needed for what I assumed would be just wrapping a call to headless Chrome. I feel like I'm just nitpicking though.

Even though the netcoreapp3.1 target could use System.Text.Json, I get that it's not possible for the netstandard2.0 one.

commented

Yes I know there are dependencies but the goal of this project was to make a replacement for wkHtmlToPdf with some addon's like sanatizing HTML. At the moment I see no need to split up the tool in different libraries to have less dependicies.