Creation and Manipulation of PDFs

Installing latest builds of wkhtmltopdf and wkhtmltoimage on linux

wget $download -O wkhtmltox.tar.xz
tar xf wkhtmltox.tar.xz
sudo mv wkhtmltox/bin/* /usr/local/bin/
rm -Rf wkhtmltox*

Create pdf posters

The program pdfposter can turn a single page into a multi-page poster.

Resize PDF A4 to letter

After a lot of searching on the interwebs I finally found a simple and reliable way to do this seemingly simple task.

  • Install pdfjam (this example is for Debian/Ubuntu)
    apt-get install pdfjam
  • Resize PDF page (insert your own filenames)
    pdfjoin infilename.pdf --paper letterpaper --fitpaper false --outfile outfilename.pdf

html to pdf conversion with pisa/xhtml2pdf

Up until now I have been using wkhtmltopdf to create pdfs, but is seems there is another alternative to explore: http://www.xhtml2pdf.com and http://pypi.python.org/pypi/pisa/
I'll report back with a comparison.

Using wkhtmltopdf to create pdfs

Writeup source files can be used to automatically create pdfs using the very useful tool: wkhtmltopdf
This can be installed in a Debian-based system (such as Ubuntu) with:
sudo apt-get install wkhtmltopdf
It is now possible to convert a writeup file to a pdf in two automated steps:
writeup myfile
wkhtmltopdf -s Letter -L 20 -R 20 -T 15 --zoom 1.2 myfile.html myfile.pdf


  • -s Letter - paper size
  • -L 20 - Left margin 20mm (ditto for R T and B)

Manipulating PDFs

Using pdfjam to make pdf impositions


apt-get install pdfjam pdftk

For more information on pdfjam see here:
and here:

For information on pdftk see here:

#2 up - first rotate to portrait (two alternative, fixed page or to end)

pdftk A=TOC-2009a.pdf B=TOC-2009b.pdf cat A1-38L B1-18L output out.pdf
Syndicate content