October 16, 2022

PDFtk is a great little command-line utility for manipulating PDF files.

My scanner has an automatic document feeder but doesn’t support duplex scanning. To scan double-sided documents I have to scan the sheets twice, once on each side. I get two PDFs: one containing the front pages and the other containing the back pages.

The command line version of PDFtk has a neat little function called shuffle. This will merge two documents taking one page from each, in order. Perfect for joining my two documents:

pdftk A=odd_pages.pdf B=even_pages.pdf shuffle A B output collated_pages.pdf

I do like to use PDFtk Pro for its helpful GUI. This version can do the same thing but requires a slightly different approach. Unlike the command line version, PDFtk Pro works in two steps:

  1. First, it runs PDFtk to combine all input files into a single PDF (yellow box below) without shuffling them; and
  2. Second, it runs PDFtk a second time with ‘optional’ commands (green box below). Here you need to shuffle the pages of the single combined file produced in step 1.


The way to achieve this is with the following “Advanced Output Options”:

%PDFTK% A=%PDFIN% shuffle A1-7 A8-end output %PDFOUT%


I had to manually specify the end of the first range (page 7) and the start of the second range (page 8). This number should match the total number of pages in each side of your document, as shown in red above (+1 for the start of the next range, of course). Note: in the screenshot I specified the last page manually (page 14) but the word ‘end’ also works to mean the last page, as shown in the text of this post.