wkhtmltopdf

Miscellaneous tools
Post Reply
Message
Author
labbe5
Posts: 2159
Joined: Wed 13 Nov 2013, 14:26
Location: Canada

wkhtmltopdf

#1 Post by labbe5 »

wkhtmltopdf is in Ubuntu repositories, so look for it in PPM/APT.

Results are very good.

In terminal :
wkhtmltopdf https://www.cyberciti.biz/open-source/h ... -software/ htmltopdf_converter.pdf

Further reading :
wkhtmltopdf - html to pdf converter
http://murga-linux.com/puppy/viewtopic. ... 60&t=84574

This is a way to archive some web pages.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#2 Post by disciple »

Results are very good.
I've never got results I was happy with, and it was very frustrating trying to sort it out :(
1. There seems to be no way to configure the default fonts, and it uses terrible ones by default.
2. When the fonts are specified in css it tends to ignore them.
3. Somehow it produces pdfs that render the fonts really badly. Maybe it is embedding bad versions of the fonts or something. You won't notice this unless you have a decent pdf viewer with antialiasing disabled. It also isn't inherent - https://www.api2pdf.com/using-custom-fo ... ss-chrome/ links to an example pdf that renders perfectly: http://www.api2pdf.com/wp-content/uploa ... 13ce75.pdf. I'd love to know what's different about their setup.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#3 Post by disciple »

Alternatives include:
https://bharatikunal.wordpress.com/2010 ... on-and-qt/
html2ps (perl version) which I use for generated html reports. It hasn't been developed for a long time and is very limited as it only supports a limited subset of css etc.
html2ps (php version) which is much more capable than the perl version, but I have never used it.
A fork of wkhtmltopdf which provided a gecko based backend. I don't know how far this got - it was mentioned in a wkhtmltopdf bug tracker or the mailing list or something, but I can't remember the exact name and am having trouble finding it again.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#4 Post by disciple »

disciple wrote:
Results are very good.
I've never got results I was happy with, and it was very frustrating trying to sort it out :(
1. There seems to be no way to configure the default fonts, and it uses terrible ones by default.
2. When the fonts are specified in css it tends to ignore them.
OK, testing again I think with local fonts on linux my problem was just that fc-cache needed to be run. With web fonts I'm probably encountering bugs, and on Windows I haven't got a clue how to make it work, but I guess we don't care about that here!
3. Somehow it produces pdfs that render the fonts really badly. Maybe it is embedding bad versions of the fonts or something. You won't notice this unless you have a decent pdf viewer with antialiasing disabled. It also isn't inherent - https://www.api2pdf.com/using-custom-fo ... ss-chrome/ links to an example pdf that renders perfectly: http://www.api2pdf.com/wp-content/uploa ... 13ce75.pdf. I'd love to know what's different about their setup.
Alternatives include:
...
There are some other suggestions at https://stackoverflow.com/questions/176 ... onversions
I seem to get pretty good results with weasypdf, which is easy to install if you already have python (python3 these days).
I haven't tried using Calibre, but I guess that should have been an obvious option.
rant: the annoying thing with even weasyprint is that it doesn't have nice defaults, so I had to write some css to use with my files. Also, for some reason it is possible to get an hr really thin, but not table borders - this is a problem it shares in common with browsers.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Post Reply