tutorcruncher / pydf

PDF generation in python using wkhtmltopdf for heroku and docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to build wkhtmltopdf from source

opened this issue · comments

Dear Samuel Colvin,

I am using your lib to generate pdf file. However, I found that it have a bug when it generate this link
https://www.highcharts.com/blog/news/175-highcharts-performance-boost.

Error response: "wkhtmltopdf: /home/sysadmin/wkhtmltopdf/qt/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp:484: void HB_HeuristicSetGlyphAttributes(HB_ShaperItem*): Assertion `glyph_pos == item->num_glyphs' failed."

I think it should update a new patch of library, please kindly refer to this fix ariya/phantomjs#11513. Two files harfbuzz-hebrew.c and harfbuzz-shaper.cpp are needed to be fixed.

Would you give me some tutors of how to re-build the wkhtmltopdf binary for AWS lambda or if you don't mind would you please fix this bug and upload new wkhtmltopdf binary.

Thank you very much and I am looking forward to your reply.

Best Regards,
Andy

HI, I just download and use the released wkhtmltopdf binary. Building is a real pain.

I don't want to update the main release with the bleeding edge version of wkhtmltopdf, but I've created a pull request to allow you to set the path to the binary you want to use, see #5.

To try it:

pip3 install git+https://github.com/tutorcruncher/pydf.git@wk-path-env-var
export WKHTMLTOPDF_PATH=/path/to/new/binary
<then run your code>

Let me know if that works and I'll merge that PR and release a new version of pydf.

Dear Samuel Colvin,

Following your guide, I can check that the bleeding edge version 0.13-alpha work well in local CentOS 7. I use the below rpm package.
https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-centos7-amd64.rpm
However, it cannot run on AWS lambda due to the error of missing some share libraries such as libpng15.so.15 and etc.... Would you please upgrade and release new version of pydf with wkhtmltox-0.13.0 static binary.

Thank you very much and I am looking for your reply.

Your problem AWS lamdba is not related to which binary is bundled with pydf - you'll need to bundle and point to those libraries either way.

Or use an open and more flexible platform eg. docker.

As I said before I won't be updating the binary in pydf until a new one is officially release. However I'd be happy to release a new version with the flexible binary path.