Alternative to wkhtmltopdf
Asked Answered
M

3

7

I need to convert html text to pdf.

Most answers here recommend to use pdfkit and wkhtmltopdf (https://wkhtmltopdf.org/). However, me company doesn't allow me to install wkhtmltopdf (it is also blocked by admin). There was an option to build from source but it seems like google blocks it due to security reason (https://github.com/wkhtmltopdf/wkhtmltopdf).

Is there an alternative or workaround?

I'm very new to python and don't have programming background, appreciate every detailed explanation.

Myopic answered 18/9, 2018 at 4:47 Comment(0)
U
6

Yes you can just download it and run it directly. I used that for a shared host (WebFaction) where I have SSH but not root access nor installation option.

cd /tmp
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd wkhtmltox/
./bin/wkhtmltopdf

You should be good.

Note that version 0.12.5 is out but has no linux-generic version. Therefore you may want to stick to 0.12.4 for now.

Underlying answered 14/12, 2018 at 14:27 Comment(1)
This still works for me on centos 7 on shared hosting. Thanks for the link.Lalo
D
3

For Python, WeasyPrint would be the obvious replacement for wkhtmltopdf. Don't have a lot of experience, personally, however.

Demobilize answered 18/6, 2019 at 19:20 Comment(1)
This is an old thread, but WeasyPrint from a URL is quite poor. It does not support current CSS websites producing very poor results.Autoclave
I
-4

I recomend you to create a PDF on user browser with pdfmake.

Good luck!

Idolist answered 18/9, 2018 at 4:58 Comment(1)
That is just a comment, and not even good one.Hoffer

© 2022 - 2024 — McMap. All rights reserved.