pdftotext can produce garbled output, especially from two-column PDFs.* Depending on what you need, scripting Adobe Reader may be an option as it does a better job.
* I did a sizeable data mining project a while ago which required converting a lot of scientific papers to plain text. pdftotext didn't work well on a lot of them, so I had a script sending click events to Adobe Reader running overnight.
This is a great tool, I've been using it for a long time. Only downside is that on Ubuntu Server certain graphics libraries aren't in the PPA so you have to download a static binary instead of using apt-get. But it's a minor quibble for a great program.
I tried porting it to OpenBSD and found building it from source to be surprisingly complicated. IIRC, it wanted me to install their own fork of qt, just to render PDFs. Pass.
I went with htmldoc (http://www.htmldoc.org/) instead. Perhaps the rendered PDFs aren't as pretty, but for my purposes, it works quite well.
I am using this for two different projects. The font issue can lead to a lot of head banging. Try messing around with your css to get it close to what you expected.
This is fantastic, thank you so much for posting this. I felt like pointing out another headless Webkit project, PhantomJS (http://www.phantomjs.org/), which can also perform HTML to PDF conversion.
edit: I've just run a comparison between wkhtmltopdf and PhantomJS and wkhtmltopdf is far superior. wkhtmltopdf produces correct output and bookmarks but has a slightly lower quality, where PhantomJS's output was not correct and without bookmarks but at a slightly higher quality. From my perspective correctness beats quality.
I was briefly looking for exactly this, after our lawyer suggested manually printing out thousands of emails and scanning to PDF. Luckily my encouragement to use a PST file finally won out. Not a confidence inspiring moment.
18 comments
[ 2.6 ms ] story [ 48.4 ms ] thread* I did a sizeable data mining project a while ago which required converting a lot of scientific papers to plain text. pdftotext didn't work well on a lot of them, so I had a script sending click events to Adobe Reader running overnight.
I went with htmldoc (http://www.htmldoc.org/) instead. Perhaps the rendered PDFs aren't as pretty, but for my purposes, it works quite well.
http://superuser.com/questions/213217/convert-html-to-image
Use gvim to pick from 100 different ready-made colour schemes:
http://www.vi-improved.org/color_sampler_pack/
Shameless plug: I describe this technique in an appendix of my technical manual.
http://www.whitemagicsoftware.com/books/indispensable/
For example:
edit: I've just run a comparison between wkhtmltopdf and PhantomJS and wkhtmltopdf is far superior. wkhtmltopdf produces correct output and bookmarks but has a slightly lower quality, where PhantomJS's output was not correct and without bookmarks but at a slightly higher quality. From my perspective correctness beats quality.