Overview

PDFjam is a small collection of shell scripts which provide a simple interface to some of the functionality of the excellent pdfpages package (by Andreas Matthias) for pdfLaTeX. At present the utilities available are:

In every case, source files are left unchanged.

A potential drawback of these utilities is that any hyperlinks in the source PDF are lost. On the positive side, there is no appreciable degradation of image quality in processing PDF files with thse programs, unlike some other indirect methods such as pdf2ps | psnup | ps2pdf (in the author's experience). [Better than the rather indirect approach taken here would be filters that work directly on the PDF code, to produce output files with hyperlinks intact.]

These tools are designed for Unix-like systems, including Mac OS X. I am told that pdfnup works fine also on Windows computers with MikTeX and the cygwin unix tools; I know of no reason why pdfjoin and pdf90 should not also work in that way.

An alternative set of PDF manipulation tools, which are java-based, is provided by the Multivalent project. They do much the same things as PDFjam, and quite a bit more. Hyperlinks don't seem to be preserved there either, though, when n-upping a document.

The software is made available free, under GPL version 2. It comes with ABSOLUTELY NO WARRANTY of fitness for any purpose whatever.

Pre-requisites

  1. A Unix-like operating system (Linux, Mac OS X, Solaris, etc.)
  2. A working, up-to-date installation of pdfTeX (including pdflatex and an up-to-date copy of pdftex.def)
  3. A working installation of the LaTeX package pdfpages (version 0.2e or later)

Download

Download the shell scripts as pdfjam_1.01.tgz.

Installation/configuration

Look at the small block of lines flagged CONFIGURATION in each of the scripts. The main requirement is to provide the correct path to pdflatex on your system. If pdflatex is in your search path (as it ought to be), the correct path is probably the answer to which pdflatex at the shell prompt. Also set here are defaults for paper size etc. These settings can be changed by editing the scripts themselves, or (better) by putting them in a site-configuration file /etc/pdfnup.conf and/or a user-defaults file ~/.pdfnup.conf to be read in that order when any of pdfnup, pdfjoin or pdf90 runs (if present these configuration files will override corresponding settings found in the scripts themselves).

Make sure that the scripts are executable by all who might need to execute it. If they are to be available to all users on your system, perhaps move them to /usr/local/bin (or make symbolic links to them there).

Using the scripts

Once the scripts are installed, help on usage can be obtained by

     pdfnup --help
     pdfjoin --help
     pdf90 --help

Some examples:

For pdfnup,

     pdfnup mywork/wasteful.pdf --nup 2x2
will produce a new 4-up file wasteful-2x2.pdf in the current directory, and
     pdfnup mywork/wasteful.pdf --nup 2x1 --outfile mywork/halfthewaste.pdf
produces a 2-up file halfthewaste.pdf in subdirectory mywork. The source pdf file wasteful.pdf is left unchanged.

   pdfnup file1.pdf file2.pdf --frame true --nup 2x2
makes new files file1-2x2.pdf and file2-2x2.pdf in the current directory, with a border printed around the 4 input pages on each output page.

Other options to pdfnup include --pages, --paper, --orient, --trim, --delta, --offset and --openright.

For pdfjoin,

  pdfjoin file1.pdf file2.pdf file3.pdf --fitpaper true
produces a new file pdfjoined.pdf in the current directory, with all pages included at their original sizes.
  pdfjoin file1.pdf file2.pdf file3.pdf --fitpaper false --paper a4paper --outfile ~docs/mybigfile.pdf
scales all of the pages to fit on A4-size paper, and makes the resultant file as ~docs/mybigfile.pdf .

One possible use for pdfjoin, then, is to change the paper size of a PDF file, for example

  pdfjoin USletterfile.pdf --paper a4paper --fitpaper false --outfile USletterfile-A4size.pdf

Other options to pdfjoin include --trim and --offset.

For pdf90,

  pdf90 file1.pdf --outfile stuff/myrotatedfile.pdf
rotates all pages and puts the result in myrotatedfile.pdf in subdirectory stuff of the current directory, while
  pdf90 file1.pdf file2.pdf
makes new files file1-rotated.pdf and file2-rotated.pdf in the current directory. pdf90 retains original page sizes in the output file.

Mac OS X only: drag-and-drop

Under Mac OS X, DropScript. can be used to make simple drag-and-drop applications from these scripts. Some sample droplets are provided in pdfdroplets.sit: these may be all you'll need! These sample droplets have been set up to put their output files in your Documents folder.

FAQ

1. Why "PDFjam"?
Because it's for PDF files, and jam is what I like best on my toast (well, second best after marmalade, anyway).

2. The thing runs but the output doesn't look the way it should. Why?
Most likely either your pdfTeX or your pdfpages installation is an old version. (Check also that pdftex.def, to be found in in .../texmf/tex/latex/graphics/, is up to date.) If the problem persists even with up-to-date versions of pdfTeX, pdftex.def and pdfpages, then please do let me know about it.

Version history

0.3: first public release of pdfnup (2002.04.04)

0.4: better error trapping, improved portability [2002.04.30]

0.5: fixed a bug which caused incompatibility with some types of unix [2002.06.24]

0.6: use of paths involving spaces now reports an error [2002.08.22]

0.7: paths involving spaces now permitted; page trimming added (thanks to Alex Montgomery for suggesting that); default output filename now has a dash inserted before the "nup" label (as in wasteful-2x2.pdf ); sample Mac OS X droplets provided [2003.01.26]

0.8: added pdfnup --help facility (thanks to Wilfrid Kendall for this suggestion) [2003.09.12]

0.9: added --openright (thanks to Jason Lewis for suggesting this) [2004.01.28]

0.95: added the possibility of site-specific and user-specific configuration files (thanks to Jason Lewis for suggesting this) [2004.01.28]

0.96: minor changes to comments in the pdfnup script [2004.02.12]

0.97: corrections to the output of pdfnup --help [2004.04.23]

0.99: various improvements to pdfnup, including the handling of multiple PDF input files. Added pdfjoin and pdf90. [2004.05.05]

0.99a: a minor change to the output of pdfnup --help and pdfjoin --help [2004.05.06]

1.00: package re-named PDFjam. [2004.05.07]

1.01: fixed a bug in pdfjoin whereby it would leave a file named "temp" in the user's home directory; further options added to pdfnup and pdfjoin. [2004.05.08]