Webkit2pdf

Some time before Christmas, I was looking for a nice gift to Clo and had a idea I found good: a good quality printed version of her blog, for the souvenir, would be quite unique and nice.

Problem is that printing it would be really painful, with about 80 posts, I didn’t want to do that manually and thought it’d be better to be able to automate that with html2ps or something like this.

html2ps having a really crappy rendering, I investigated Webkit and found it would print nicely, but it only supported printing via print dialog, which was painful too. So I dived into webkit-gtk’s code and patched it and added support for PDF export (via GTK+ print support); then proceeded to write a little app to batch-export to PDF a list of URLs.

That done, I used pdftk (the PDF ToolKit) to concatenate all these PDFs into a big one, uploaded it to lulu.com and there was the result:

blog

Some more iterations of the webkit patch later and with the help of Gustavo Noronha of GNOME fame, an official API was defined, implemented and commited to Webkit. After reworking my app a bit to fit this API, I’ve been able to test it with the second volume of Clo’s blog (yes, she writes quite a lot, this second volume has 350 pages for little Paul’s first six monthes !), and here’s a new piece of free software born: webkit2pdf. It requires a fairly recent Webkit version; I’m not even sure they released since the patch’s in.

  •  
  •  
  •  
  •  

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
christophe Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of
christophe
Guest
christophe

Trop fort :-)
Et quel beau cadeau !

news for few, stuff no-one cares about