When I generate pdf files of part designs for printing, each drawing is a single file, each only a single page. This is great for viewing/sharing/printing a single part, but when I’m printing packs of technical drawings, printing several copies each of 50 (ish) pdf files and then collating those into packs is not simple. And provides endless chances for mistakes. And is really tedious!

Fortunately, computers are meant (!) to reduce human workload, so if the collation work could be passed off to a script that ordered the pages, and joined the drawing files into a single pdf ready for printing; that would save actual physical work.

Enter Pdftk — “the pdf toolkit” and a graphical front end for it: PDF Chain.

Both are moments away from install under Ubuntu:

[apt-get install pdftk](apt://pdftk)

[apt-get install pdfchain](apt://pdfchain)

While pdfchain is very nice, it does have a 26 file limit (because pdftk uses a single uppercase letter character to keep track of files — see examples), but if your pdf files are already arranged in alphabetical order, using pdftk from the command line can concatenate files using wildcards.

All that’s needed to join all pdf files in a directory, in alphabetical order, is:

pdftk *.pdf cat output all.pdf

I store all part drawings for a model together in a folder, where their filename is the part number. To join all the parts from one assembly, I can use:

pdftk a001_p*.pdf cat output A001_V001.pdf

(I’m using capital letters to distinguish the compiled document from the single pages - this comes in handy in a moment)

Or I can prefix the assembly set with the exploded diagram:

pdftk a001_v001_expl.pdf a001_p00*.pdf cat output A001_V001.pdf

So to building a full document, assembly by assembly, requires a line to produce each assembly document followed by a single line to create the complete document:

pdftk A00*.pdf cat output M0.1.pdf

(using capital letters excludes having the exploded diagram in twice)

Now that’s easier than manually reordering hundreds of printed pages!


_Part numbering works as follows:

  • Model: M

  • Assembly: A_V

  • Part: A_P_R

_