Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using weasyprint instead of wkhtmltopdf? #1045

Closed
hadmut opened this issue Jan 10, 2023 · 2 comments
Closed

Using weasyprint instead of wkhtmltopdf? #1045

hadmut opened this issue Jan 10, 2023 · 2 comments

Comments

@hadmut
Copy link

hadmut commented Jan 10, 2023

Hi,

I just wanted to teach a ruby gem, which is usually run inside a docker container based on Alpine Linux to generate PDFs using wicked_pdf

Problem: wkhtmltopdf is not available under Alpine as a package. And wkhtmltopdf.org (https://wkhtmltopdf.org/downloads.html) doesn't offer a precompiled binary for Alpine, therefore the gem wkhtmltopdf-binary doesn't bring a usable binary.

Instead, Alpine comes with weasyprint, which more or less does the same job as wkhtmltopdf. Some say, it generates better results and has a better implemenation and HTML compatibility, while others say, that it lacks some of the math functions in CSS. But in general, they are competitors.

Of course, one could (probably, not sure whether it works with the musl c library) compile wkhtmltopdf on Alpine, but that would require lots of software installation such as compilers and libraries.

Since weasyprint in general does pretty much the same job as wkhtmltopdf, how much work would it be to get wicked_pdf running with weasyprint as well?

regards

@unixmonkey
Copy link
Collaborator

I'm not currently interested in having wicked_pdf handle multiple backend PDF generation engines (1 is more than enough trouble). You could however, fork this library or use it as inspiration for a weasyprint wrapper.

Or you could use the existing weasyprint gem.

If you'd really like to get wkhtmltopdf running on Alpine, there are some notes in this thread:
zakird/wkhtmltopdf_binary_gem#53

And there's a binary provider gem to install wkhtmltopdf on Alpine here:
https://github.com/khalilgharbaoui/wkhtmltopdf-binary-edge-alpine

Please let me know how it goes for you, and what you path you chose to go with!

@hadmut
Copy link
Author

hadmut commented Jan 11, 2023

I still need some testing and comparing wkhtmltopdf with weasyprint, both seem to have their advantages and disadvantages. It will take some time to get to a final answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants