Need help with pdfjam?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

156 Stars 12 Forks GNU General Public License v2.0 56 Commits 14 Opened issues


The pdfjam package for manipulating PDF files

Services available


Need anything else?

Contributors list

# 29,395
3 commits
# 68,442
2 commits


Reuben Thomas

A snapshot of this page is included as in the distributed package. The most up-to-date version is maintained online at

  1. Overview
  2. Pre-requisites
  3. Documentation
  4. Installation
  5. Configuration
  6. Using pdfjam
  7. FAQ
  8. Reporting bugs
  9. Version history


What is pdfjam?

The pdfjam package makes available the

shell script that provides a simple interface to much of the functionality of the excellent pdfpages package (by Andreas Matthias) for LaTeX. The
script takes one or more PDF files (and/or JPG/PNG graphics files) as input, and produces one or more PDF files as output. It is useful for joining files together, selecting pages, reducing several source pages onto one output page, etc., etc.

A potential drawback of

and other scripts based upon it 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
, unlike some other indirect methods such as
(in the author's experience).

is designed for Unix-like systems, including Linux and Mac OS X. It seems that it will work also on Windows computers with a suitable installation of Cygwin (with TeX Live installed), but this has not been thoroughly tested.

An alternative set of PDF manipulation tools, which are java-based, is provided by the Multivalent project. Yet another alternative set of tools is PDFsam. Those alternatives do much the same things as

, and maybe quite a bit more too.

The pdfjam software is made available free, under GPL version 2 (see the file named

that is included with the package). It comes with ABSOLUTELY NO WARRANTY of fitness for any purpose whatever.

Wrapper scripts no longer included here

Previous versions of pdfjam (before 3.02) included some other scripts too, in addition to the

script iteslf. Those other scripts are simple wrappers for calls to
, designed to perform some common tasks such as joining or n-upping PDF files or to illustrate other features; they are not very elaborate, and nor are they extensively tested. They are probably best viewed as simple templates that can be used for constructing more elaborate wrapper scripts as required.

Those 'wrapper' scripts are no longer maintained. I continue to make them available in a separate repository, in case anyone wants to see them, to use them, or to improve and maintain them independently as a separate project.

The specific wrapper scripts that were removed from the pdfjam package at version 3.02 are:

  • pdfnup
  • pdfjoin
  • pdf90
  • pdfflip
  • pdfbook
  • pdfjam-pocketmod
  • pdfjam-slides3up

For those scripts and for more information on them, please now see


  • A Unix-like operating system (Linux, Mac OS X, FreeBSD, etc.; possibly Cygwin)
  • A working, up-to-date installation of LaTeX (including at least one of
  • A working installation of the LaTeX package pdfpages (version 0.4f or later)
  • Some of the options offered by
    also require the LaTeX packages geometry and hyperref.

For some years now, pdfjam has been included in the TeX Live distribution, which includes all the necessary programs and packages to make

run smoothly. If you have the necessary bandwidth and disk space for it, I do recommend installing TeX Live.


The primary documentation for

is obtained (after installation of
) via the command
pdfjam --help

This gives information on the arguments to

, and the default settings that apply at your installation. In addition to the arguments that are explicitly documented there,
provides access to all of the options of the pdfpages package: that's a large number of options, and it's a set of options that might change, so users are referred to the current pdfpages manual (PDF) to see what's available.

In case you want to look at the

pdfjam --help
text template online, for example before you decide whether to install pdfjam, the source is available at

There is also a (very basic)

page, accessed in the usual way (after installation) by
man pdfjam


There are two main ways:

  1. Install the current TeX Live distribution (how you do this will depend on details of your operating system). TeX Live will already contain a recent release of pdfjam. Many thanks to Karl Berry for setting up and maintaining pdfjam as a CTAN package that is part of TeX Live.

  2. Install it yourself (e.g., if you don't want TeX Live, or if you want a later release of pdfjam than the one that's currently in TeX Live). Download the latest packaged release of pdfjam from If for some reason you don't want the latest released version, or even a recently released version, you can still get older versions too: see

The first way, via TeX Live, is recommended as the easiest way for most users.

If you go the second way, then you will have a bit more to do:

  • The
    shell script in the bin sub-directory of the released package should be placed on the
    of anyone who needs to use it.
  • The
    file in the man1 sub-directory should be installed on the
    of all who might need to read it.


On many unix-like systems

should run without any further configuration, provided that the pre-requisite TeX installation (such as TeX Live) is present. If you want to check (e.g., prior to installation) that
will work on your system, then
  • unzip the
    archive (inside the package)
  • cd
    to your newly made
    sub-directory and follow the instructions that appear there in

If configuration is needed, this can be done through a site-wide or user-specific configuration file. This might be necessary if, for example, your site has a non-standard TeX installation, or a non-standard location for temporary files, or a specific paper size for output PDFs --- or some other reason.

The file pdfjam.conf is a sample configuration file which can be edited as needed. After editing, either install the file for site-wide use (at

, or
) or as a user-defaults file at
. User settings made at
override corresponding settings made in a site-wide configuration file.

For example, if you prefer to use

as your default LaTeX engine (in place of the standard
), and you want your output page size to be "US letter" size paper by default, you would simply include the lines

in a plain text file named '

' in your home directory. The path
specifies exactly which LaTeX program will be used: it could be a path to any one of the
executables. (You can get the full path to an executable by, for example, the command
which xelatex
.) The code word
is how LaTeX refers to that particular page size. For other available paper sizes, and all the many other options that could be set as defaults if you want, please see the output of
pdfjam --help

On some systems it might even be necessary to change the list of places (i.e.,

and others as listed above) that is searched for site-wide configuration files. This can only be done by editing the
script itself. To see which directories on your system are searched for a file named
, look at the output of
pdfjam --configpath

Using pdfjam

For a full overview of what

can do, the importance of the pdfpages manual (PDF) cannot be stressed enough! The following examples merely serve as a brief introduction.

Example 1: Batch 2-upping of documents

Consider converting each of two documents to a side-by-side "2-up" format. Since we want the two documents to be processed separately, we'll use the

pdfjam --batch --nup 2x1 --suffix 2up --landscape file1.pdf file2.pdf

This will produce new files

in the current working directory.

Example 2: Merging pages from 2 documents

Suppose we want a single new document which puts together selected pages from two different files:

pdfjam file1.pdf '{},2-' file2.pdf '10,3-6' --outfile ../myNewFile.pdf

The new file

, in the parent directory of the current one, contains an empty page, followed by all pages of
except the first, followed by pages 10, 3, 4, 5 and 6 from

The resulting PDF page size will be whatever is the default paper size for you at your site. If instead you want to preserve the page size of (the first included page from)

, use the option
--fitpaper true

All pages in an output file from

will have the same size and orientation. For joining together PDF files while preserving different page sizes and orientations,

is not the tool to use.

Example 3: A 4-up document with frames

To make a portrait-oriented 4-up file from the pages of three input files, with a thin-line frame around the input pages:

pdfjam file1.pdf file2.pdf file3.pdf --no-landscape --frame true --nup 2x2 --suffix 4up --outfile ~/Documents

Here a directory was specified at

: the resultant file in this case will be
. (Note that if there's a writeable file with that name already, it will be overwritten: no check is made, and no warning given.)

Example 4: Convert a 'US letter' document to A4

Suppose we have a document made up of 'US letter' size pages, and we want to convert it to A4:

pdfjam 'my US letter file.pdf' --a4paper --outfile 'my A4 file.pdf'

Example 5: Handouts from presentation slides

A useful application of

is for producing a handout from a file of presentation slides. For slides made with the standard 4:3 aspect ratio a nice 6-up handout on A4 paper can be made by
pdfjam --nup 2x3 --frame true --noautoscale false --delta "0.2cm 0.3cm" --scale 0.95 myslides.pdf --outfile myhandout.pdf


option here comes from the pdfpages package; the
option is passed to LaTeX's

Slides made by LaTeX's beamer package, using the

class option, work especially nicely with this! The example wrapper scripts
, in the pdfjam-extras repository, are for 3-up and 6-up handouts, respectively.

Example 6: Trimming pages; and piped output

Suppose we want to trim the pages of our input file prior to n-upping. This can be done by using a pipe:

pdfjam myfile.pdf --trim '1cm 2cm 1cm 2cm' --clip true --outfile /dev/stdout | pdfjam --nup 2x1 --frame true --outfile myoutput.pdf


option specifies an amount to trim from the left, bottom, right and top sides respectively; to work as intended here it needs also
--clip true
. These (i.e.,
) are in fact options to LaTeX's
command (in the standard graphics package).

Thanks go to Christophe Lange and Christian Lohmaier for suggesting an example on this.

Example 7: Output pages suitable for binding

To offset the content of double-sided printed pages so that they are suitable for binding with a Heftstreifen, use the

pdfjam --twoside myfile.pdf --offset '1cm 0cm' --suffix 'offset'

Example 8: Input file with nonstandard name

To use PDF input files whose names do not end in '

', you will need to use the
option. This depends on the availability of the
utility, with support for the options
; this can be checked by trying
file -Lb 'my PDF file'


'my PDF file'
is the name of a PDF file on your system. The result should be something like '
PDF document, version 1.4
' (possibly with a different version number).

With '

file -Lb
' available, we can use PDF files whose names lack the usual '
' extension. For example,
pdfjam --nup 2x1 --checkfiles 'my PDF file'

will result in a file named '

my PDF file-2x1.pdf
' in the current working directory.

Example 9: Rotate every 2nd page

If you want to print a landscape-oriented PDF document on both sides of the paper, using a duplex printer that does not have 'tumble' capability, make a new version with every second page rotated for printing:

pdfjam --landscape --doublepagestwistodd true my-landscape-document.pdf


1. The script 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. You could check also that

, typically to be found in
, is up to date. If the problem persists even with up-to-date versions of pdfTeX,
and pdfpages, then please do report it.

2. What can I do to solve a 'Too many open files' error?

This error has been reported to occur sometimes, when dealing with large numbers of documents/pages. A suggested solution, if this happens, is to include additionally (in the call to

    -- preamble '\let\mypdfximage\pdfximage \def\pdfximage{\immediate\mypdfximage}'

See for example for this suggestion and links to more information.

Reporting bugs

Please report any bugs found in

, either

Some known problems:

  • Sometimes font information (such as ligatures) is lost from the output of
    . It seems that a fairly simple fix when this happens is to add the option
    --preamble '\pdfinclusioncopyfonts=1'
    in your call to
  • In Cygwin, using
    in a pipeline does not seem to work. The problem seems to be with Cygwin's handling of file descriptors within pipelines.
  • The
    option can sometimes clash with other elements of the LaTeX preamble. Some specific things to watch out for:
    • If the preamble needs to set further options to the geometry package, when the geometry package has already been loaded in order to set a special page size, be sure to use the
      command for that.
    • If the preamble needs to set options to the hyperref package, when the hyperref package has already been loaded in order to specify PDF document information, be sure to use the
      command for that.
    • If options to the color package are to be specified in the preamble, do not at the same time use the
      option to

Version history

Overview of the history

This all grew originally from a script named

. That was later joined, in a published package called 'PDFjam', by two further scripts

At version 2.00, everything was unified through a single script

, with many more options. Along with
various 'wrapper' scripts --- i.e., other scripts that use
in different ways --- were provided, mainly as examples.

From version 3.02, the extra 'wrapper' scripts are removed from the package, mainly because they are hard to maintain: different users want different things, and

itself provides all the options in any case. So I have broken out the wrapper scripts into a separate repository, unsupported --- so that people can still see and use/adapt them if they want. And maybe even someone else will want to take on the task of improving and maintaining some of them, who knows? The wrapper scripts (no longer maintained) can now be found at

Version release notes

3.03 [2019-11-18]:

  • Built package now (again) has tests in a zip archive. (needed for CTAN)

3.02 [2019-11-14]:

  • Re-styled the package name to pdfjam. (Previously the package --- which then contained several scripts --- was named PDFjam).
  • Moved everything to a new home on the web at
  • Simplified the package by removal of all the 'wrapper' scripts (
    , etc.).
  • Settings specified via
    are now protected from the normal tidying of the TeX input file to remove redundant packages.
  • The possibility to use
    in place of
    is now described explicitly in the README. The specification of which LaTeX engine to use can be made either in a configuration file, or on the command line via option (for example)
    --latex /usr/bin/xelatex
    . Thanks to Mircea for suggesting this.
  • Added new
    option, so as to allow for example
    --runs 2
    in a situation where two runs of
    ) are needed (typically where the result document is being indexed in some way, so more than one run is needed). Thanks to Ferdinand for this suggestion (and patch).
  • Default paper size is now guessed from the locale where possible, with fallback default size being ISO A4 ('a4paper' in LaTeX). This can still be over-ridden in a configuration file, or on the command line. Thanks to Jonathan for this suggestion.
  • Innocuous edits made to make pdfjam work better in Cygwin. Thanks to Lucas for sending a helpful patch for this.
  • Included a note in the FAQ about the (sometimes reported) 'Too many open files' error. Thanks to George for information about this.
  • Tidying of the
    script, and better organisation of the
    folder. Thanks to Lucas for help with this.

Older releases are still available at

2.09 [never released]:

  • The default behaviour of
    is reverted to its pre-2.06 state, because
    --booklet true
    seems to be problematic for some users.

2.08 [2010-11-14]:

  • Fixed a bug in one of the tests.

2.07 [2010-11-13]:

  • Two other common graphics formats (JPG and PNG) are now explicitly allowed as input files (i.e., not only PDF files are allowed as inputs).

2.06 [2010-05-11]:

  • Changed the
    script to include
    --booklet true
    as the default behaviour (thanks to Julien Bossert for this good suggestion).

2.05 [2010-04-25]:

  • Changes to the
    script [the
    option is now redundant, and there's a new
    option for binding along the short edge of pages instead of the long edge (thanks to Marco Pessotto for this).
  • The
    option to
    is enhanced, to allow multiple instances which get concatenated.
  • Also various minor corrections to man pages.

2.04 [2010-04-22]:

  • Various minor improvements suggested by Debian maintainers (thanks to Eduard Bloch for these). The main things are:
    • addition of the
    • liberalisation of
      to allow files in JPEG format to be specified as input, as well as PDF;
    • tidying of the man files;
    • and more use of
      , to avoid forking.

2.03 [2010-04-20]:

  • Fixed a bug which caused problems when your
    is the zsh shell.
  • Fixed a bug which prevented the correct representation of many UTF-8 characters in

2.02 [2010-04-14]:

  • More progress on portability.
  • Introduced the beginnings of a suite of tests.
  • Iimprovements in the
    functionality, and in the treatment of file permissions (thanks to Marco Pessotto for these).

2.01 [2010-04-13]:

  • Fixed a silly bug (thoughtless use of "
    test -a
    " in a couple of places) which seriously affected portability.

2.00 [2010-03-14]: a major re-design

This is not completely backward-compatible with previous versions of the

scripts. The differences in interface are few, though, and the main ones are listed below.
  • The new script
    now does all the work; all the other scripts included with the package are just simple wrappers for
  • New
    makes available essentially all of the facilities of the pdfpages package (without having to know what they are).
  • Various security and portability issues have been resolved. (None of the scripts now calls for
    ; and the handling of temporary files is now much safer.)
  • pdfjam
    can take PDF input from
    , and send output to
    . (This allows
    to be used in a pipeline.)
  • If the
    option specifies a relative path, that path is now relative to the current working directory (as is normally expected of unix utilities). This is different behaviour from previous versions.
  • With multiple input files,
    offers two distinct methods of processing. This is different behaviour from previous versions.
    1. The default is to take pages as specified from the input files, and combine them into a single document.
    2. If the
      option is used,
      operates separately on the input files, producing one output file per input file.
  • Page selection is available separately for each input file. A difference from previous versions is that the
    keyword is no longer used.
  • pdfjam
    uses the
    command from pdfpages, as a result of which all pages in an output file have the same size and orientation. This is different behaviour from previous versions.
  • Output page orientation is now controlled by using
    (negated, if necessary, by
    ). The previous
    option is no longer used, and in particular "
    --orient auto
    " is no longer available. This is different behaviour from previous versions.
  • Other new features include:
    • --keepinfo
      option, to allow preservation of PDF document information, if the
      utility and the LaTeX
      package are available (thanks to Robert Wenner for suggesting this);
    • --pdftitle
      options, to specify new PDF document information (these require the LaTeX
    • many more "named" output page sizes are available if the LaTeX
      package is installed (the full list of allowed paper specifications is:
      a0paper, a1paper, a2paper, a3paper, a4paper, 
      a5paper, a6paper b0paper, b1paper, b2paper, b3paper, b4paper, 
      b5paper, b6paper letterpaper, executivepaper, legalpaper
      ; thanks to Corné Verbruggen and Mel Irizarry for suggesting this) and non-standard page sizes can also be defined;
    • --checkfiles
      option to request that input files be checked using the
      utility, rather than requiring the file name to end in "
      " or "
    • --twoside
      option, to allow the LaTeX twoside class option to be specified (thanks to Johannes Reinhard for suggesting this);
    • --pagecolor
      option, to allow the background colour of output pages to be changed (thanks to James Fisher for suggesting this);
    • --vanilla
      option to run
      without reading site-wide or user configuration files.
  • In addition, various reported bugs have been fixed — many thanks to all those kind people who reported them.

1.21 [2009-01-19]:

  • Bug fixes, including security issues (many thanks to Eduard Bloch, Robert Buchholz and Martin Vaeth for helpful reports on vulnerabilities and for kindly contributing patches).
  • The scripts now call for
    as interpreter.
  • Availability of
    is now also assumed.
  • The Mac OS X droplets now look for
    at (by default)

1.20 [2005-01-25]

  • Added minimal man pages.
  • Added extra possible locations for the site-wide configuration file.

1.11 [2004-10-13]:

  • Added the
    option to
    , 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!

1.10 [2004-06-24]:

  • 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.

1.03 [2004-05-09]:

  • Minor changes towards POSIX compliance.

1.02 [2004-05-08]:

  • Added a COPYING file to the package.

1.00 [2004-05-07]:

  • Package re-named PDFjam.

0.99a [2004-05-06]:

  • A minor change to the output of
    pdfnup --help
    pdfjoin --help

0.99 [2004-05-05]:

  • Various improvements to
    , including the handling of multiple PDF input files. Added

0.97 [2004-04-23]:

  • Corrections to the output of
    pdfnup --help

0.96 [2004-02-12]:

  • Minor changes to comments in the

0.95 [2004-01-28]:

  • Added the possibility of site-specific and user-specific configuration files (thanks to Jason Lewis for suggesting this).

0.9 [2004-01-28]:

  • Added
    (thanks to Jason Lewis for suggesting this).

0.8 [2003-09-12]:

  • Added
    pdfnup --help
    facility (thanks to Wilfrid Kendall for this suggestion).

0.7 [2003-01-26]:

  • 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
  • Sample Mac OS X droplets provided.

0.6 [2002-08-22]:

  • Use of paths involving spaces now reports an error.

0.5 [2002-06-24]:

  • Fixed a bug which caused incompatibility with some types of unix.

0.4 [2002-04-30]:

  • Better error trapping, improved portability.

0.3 [2002-04-04]:

  • First public release of

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.