HakanL / WkHtmlToPdf-DotNet

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
GNU Lesser General Public License v3.0
366 stars 66 forks source link

Fix cover not working #134

Closed mulgaBrian closed 1 month ago

mulgaBrian commented 1 month ago

Adds the necessary settings for wkhtmltopdf.dll to add the cover page. To remove the margins you need to update wkhtmltopdf.dll itself with the fix margins pr. I have tested with the original and my own modified wkhtmltopdf dll.

HakanL commented 1 month ago

Looks good, thanks for contributing! Have you submitted a PR to the native/parent project as well to change the margin?

mulgaBrian commented 1 month ago

The wkhtmltopdf project is archived. I used https://github.com/wkhtmltopdf/wkhtmltopdf/pull/5193 and built my own dll to replace the one in this project.

HakanL commented 1 month ago

Yeah that's what I thought as well. What is the purpose of removing the margins, is there a report issue about that?

mulgaBrian commented 1 month ago

I build and use an image to make the cover page which, when un-patched leaves the margins as a white area around the image. After the patch the image covers the whole page.

HakanL commented 1 month ago

I see, and I assume that issue is also when using the native command-line wkhtml tool, so it's strictly in that library? Sometimes I wonder if it would be worth the effort to fork the native library, upgrade it to use a newer version of libssl. But I think they're using a version of QT that is very old, so it may be hard to get everything running (for cross-compiling). And I'm not sure I'm the right person to maintain that project either.

mulgaBrian commented 1 month ago

I am building the wkhtmltopdf project myself to produce the dll and exe. It has problems with the vagrant windows builds that I haven't been able to fix yet so I use the mxe-cross builds to get them. This works best for me on older versions of Ubuntu which have the gcc7 compilers. The Qt version 4 is the last open source version so the Qt section cannot be updated. I am also building this/your project myself to use the updated wkhtmltopdf binaries.

HakanL commented 1 month ago

Yeah, it would be an undertaking to set up a build environment for all supported environments of the binaries, locked down to the older versions of dependencies where needed. I guess it could be done in a docker environment where the older version of gcc could be used, etc.