Scaling and Sizing with PDFJam

I find myself needing to take a PDF, output it at a specific size, and have the result offset to the top right hand side of the screen. To achieve it, I needed a few new switches to my good friend PDFJam, so I thought I’d share my command!

pdfjam --suffix converted --papersize '{1920px,1080px}' --scale 0.4 --trim "-6cm -1cm 13cm 8cm" slides.pdf

The --suffix is instead of giving an output filename, whatever you feed in ends up with the suffix in its filename. This is very handy because I use this command in a script and only need to pass in one variable. The --papersize isn’t a switch I have used before either but you can set exact sizes for the final output which is nice. The --trim switch can also be used to set --clip=true to remove the trimmed space from the document if desired.

I find PDFJam a very handy tool but with not nearly enough blog posts and code snippets around, so I’m dropping my command for future reference (yours as well as mine!).

Printing Many PDFs Per Page

Much of my work revolves around documents or slides, and I use PDF format for pretty much everything I do. In the last year or so I’ve developed a love affair with rst2pdf which means I’m doing more PDF now than ever.

This weekend I was working on a project which needed a programatically-generated PDF file to be many-slides-per-page – and for this I adopted a tool I haven’t used before: pdfjam (installed straight from apt on Ubuntu).

In fact it was pretty easy to get going with it: to print my existing PDFs at 4-per-page, I used this command:

pdfjam --landscape --nup 2x2 --a4paper -q slides.pdf -o handout.pdf

The slides themselves were already landscape so I specified the target document should also be landscape. The --nup 2x2 is the magic that prints many slides per page, and it seems like it can do various nice tricks with handouts. Running through the other arguments that I used: --a4paper for the paper size, -q to stop it from chattering (which it does by default, even when everything worked), slides.pdf was my input file and -o handout.pdf the target file to put the new layout into.

Until now I’ve mostly worked with pdftk for everything, but I couldn’t find a way to do this using it. Pdfjam is now a welcome addition to my PDF toolchain, so I thought I’d share.