wooio / htmltopdf-java

An HTML to PDF conversion library written in Java, based on wkhtmltopdf.
MIT License
173 stars 97 forks source link

Provide statically linked libwkhtmltox.so #30

Open krzemin opened 5 years ago

krzemin commented 5 years ago

Hi, thanks for creating this wrapper. I like simplicity of the API. It solved my problem today when developing locally.

But when I tried to run the same code in docker, I encountered the same dependency related problems as in #29 and #23.

Suggestion in https://github.com/wooio/htmltopdf-java#troubleshooting section doesn't really help much, because .so library packed in the jar requires specific versions of the libjpeg, libpng, libssl. It will always be hard to find correct versions of these so that library can be loaded.

A different approach may work instead: to provide statically linked libwkhtmltox.so so it doesn't require any system dependencies. It will increase jar size and memory footprint, but at least your library would be usable.

benbarkay commented 5 years ago

That's not a bad idea, though I'm thinking now that maybe it's a mistake to include the native library in the releases altogether, and that instead we should use whatever is installed in the user's system, or allow the user to provide a local shared library.

If you'd like, you can make a pull request with updated shared libraries (they're kept right there in the repo) and if it all works, I'll make a release.

krzemin commented 5 years ago

It would be best for users if they can choose between:

I think it's mistake to include shared library as the versions of specific library dependencies changes so quickly that's impossible to keep them up in the longer term.

Because of the expected size of the statically linked lib, maybe it would be better actually to provide separate mvn artifact for it (io.woo:htmltopdf-static-libs:1.x.x)?

lehphyro commented 4 years ago

Are you planning to implement this? That would be really helpful! I'd do it myself if I knew how, sorry.