This file is kept up to date at http://go.warwick.ac.uk/pdfjam.

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 the other PDFjam scripts 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.

For Mac OS X, n-up with a more visual interface is provided by PDF Nup Maker. Like PDFjam, this is a front end to pdflatex/pdfpages.

The PDFjam software is made available free, under GPL version 2 (see the file named COPYING that is included with the package). 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.) with the bash shell.
  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 packages pdfpages (version 0.2e or later) and geometry.

Download

Download the shell scripts as pdfjam_1.30b.tgz.

Eduard Bloch has kindly packaged PDFjam for Debian. Paul Chvostek has kindly made a port to FreeBSD. Pander has kindly provided a link to Ubuntu packages.

For Mac OS X droplets, see below.

PDFjam is a project at freshmeat: please subscribe there to receive update announcements.

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), no change should be needed. Also set there are defaults for paper size etc. These settings can be changed by editing the scripts themselves, or (much better) by putting them in a site-configuration file (at /etc/pdfnup.conf, /usr/share/etc/pdfnup.conf, /usr/local/share/pdfnup.conf, or /usr/local/etc/pdfnup.conf) and/or a user-defaults file ~/.pdfnup.conf to be read in that order when any of the scripts runs (if present these configuration files will override corresponding settings found in the scripts themselves). For example, if you want your own output to be on "US letter" size paper by default, simply put the line

  paper=letterpaper

in a plain text file named .pdfnup.conf in your home directory.

Make sure that the scripts are executable by all who might need to execute them. 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). The man pages should be installed on the MANPATH of all who need to read them.

Using the scripts

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

  pdfnup --help
  pdfjoin --help
and so on.

Some examples:

In every case, the names of all input files must end in either ".pdf" or ".PDF" (not, for example, ".pdf.1"). This requirement might be relaxed in a future release.

For pdfnup,

  pdfnup mywork/wasteful.pdf --nup 2x2

will produce a new 4-up file wasteful-2x2.pdf in directory mywork , and

  pdfnup mywork/wasteful.pdf --nup 2x1 \
       --outfile mywork2/halfthewaste.pdf

produces a 2-up file halfthewaste.pdf in directory mywork2. 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, --scale and --openright.

We can also use pdfnup simply to select pages from a PDF file:

  pdfnup file1.pdf --nup 1x1 --pages 1,3,5-6 \
     --outfile file1-selection.pdf

makes a new file file1-selection.pdf in the current directory, which contains only the selected pages from file1.pdf.

A particularly useful application of pdfnup is for producing a handout from a file of presentation slides. For slides created at the standard size by the (superb!) LaTeX beamer package, a nice handout on A4 paper can be made by

  pdfnup --nup 2x3 --frame true --noautoscale false  \
   --orient portrait --delta "0.2cm 0.3cm" \
   --scale 0.95 myBeamerSlides.pdf

For pdfjoin,

  pdfjoin file1.pdf file2.pdf file3.pdf --fitpaper true

produces a new file file3-joined.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. The output filename and location are determined by the last input file if --outfile is not specified.

For pdf90, pdf180, pdf270, pdfbq, for example,

  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. The original page sizes are retained in the output file. All of pdf180, pdf270 and pdfbq behave in the same way.

For pdfbook,

  pdfbook --signature 8 --orient landscape --pages 32-98 myfile.pdf

arranges the selected pages of myfile.pdf into 8-page signatures in 2x1 n-upped format, suitable for printing to make a booklet for example. The pdfbook script appears here following several requests, but it has not been thoroughly tested by its author: feedback and reports of problems would be welcomed.


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_1.30b.tgz: these may be all you'll need! The sample droplets look like this:

These droplets assume that your pdflatex is at /opt/local/bin/pdflatex (as it might be if you installed TeX via MacPorts). If pdflatex lives somewhere else on your system, the droplets won't work until you include in your home directory a file named .pdfnup.conf (or until there is a system-wide file pdfnup.conf at one of the four locations listed above), containing the line

pdflatex=/path/to/your/pdflatex

where /path/to/your/pdflatex is the answer you get when you type which pdflatex in the Terminal.


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.

3. What use is pdfbq, and why is it so oddly named?
The pdfbq script might be used, for example, if printing is needed on transparencies that must be laid face-down on an overhead projector so that you can write on the other side. The name "pdfbq" is pronounced (by its author, at any rate) as "PDF backwards"; and the visual shape of the name, in most simple fonts anyway, perhaps serves as a reminder that it simply performs a reflection.

Reporting bugs

Please report any bugs or misfeatures, via the web page at http://go.warwick.ac.uk/pdfjam.

Version history

1.30b: [2008-06-05]

1.20: added minimal man pages; added extra possible locations for the site-wide configuration file [2005-01-25]

1.11: added the --scale option to pdfnup, which allows page margins either to be enlarged (e.g,. --scale 0.9) or reduced (e.g,. --scale 1.1) by scaling the page contents. By popular request! [2004-10-13]

1.10: output files now appear by default in same directory as input, rather than in the current working directory; fixed a bug that caused the scripts not to work on some versions of Solaris (thanks to Daniel Gebhart); major improvements to the Mac OS X sample droplets. [2004-06-24]

1.03: minor changes towards POSIX compliance. [2004-05-09]

1.02: added a COPYING file to the package. [2004-05-08]

1.01: fixed a bad (and accidental) feature in pdfjoin whereby it would leave a file named "temp" in the user's home directory; some new options added to pdfnup and pdfjoin. [2004-05-08]

1.00: package re-named PDFjam. [2004-05-07]

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

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

0.97: corrections to the output of pdfnup --help [2004-04-23]

0.96: minor changes to comments in the pdfnup script [2004-02-12]

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

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

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

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.6: use of paths involving spaces now reports an error [2002-08-22]

0.5: fixed a bug which caused incompatibility with some types of unix [2002-06-24]

0.4: better error trapping, improved portability [2002-04-30]

0.3: first public release of pdfnup [2002-04-04]