Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 09 Dec 2019, 07:38
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
wkhtmltopdf
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
labbe5

Joined: 13 Nov 2013
Posts: 2082
Location: Canada

PostPosted: Tue 22 Oct 2019, 07:39    Post subject:  wkhtmltopdf
Subject description: converting html to pdf - CLI
 

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/html-to-pdf-freeware-linux-osx-windows-software/ htmltopdf_converter.pdf

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

This is a way to archive some web pages.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6993
Location: Auckland, New Zealand

PostPosted: Thu 24 Oct 2019, 18:36    Post subject:  

Quote:
Results are very good.

I've never got results I was happy with, and it was very frustrating trying to sort it out Sad
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-fonts-with-wkhtmltopdf-and-headless-chrome/ links to an example pdf that renders perfectly: http://www.api2pdf.com/wp-content/uploads/2018/11/e51b48f0-e6e5-11e8-ac0c-b90d0913ce75.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
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6993
Location: Auckland, New Zealand

PostPosted: Thu 24 Oct 2019, 18:55    Post subject:  

Alternatives include:
https://bharatikunal.wordpress.com/2010/01/31/converting-html-to-pdf-with-python-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
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6993
Location: Auckland, New Zealand

PostPosted: Sun 03 Nov 2019, 21:45    Post subject:  

disciple wrote:
Quote:
Results are very good.

I've never got results I was happy with, and it was very frustrating trying to sort it out Sad
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!
Quote:
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-fonts-with-wkhtmltopdf-and-headless-chrome/ links to an example pdf that renders perfectly: http://www.api2pdf.com/wp-content/uploads/2018/11/e51b48f0-e6e5-11e8-ac0c-b90d0913ce75.pdf. I'd love to know what's different about their setup.

Quote:
Alternatives include:
...

There are some other suggestions at https://stackoverflow.com/questions/176476/how-can-i-automate-html-to-pdf-conversions
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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0325s ][ Queries: 12 (0.0041s) ][ GZIP on ]