| 1 |
.TH PDFJAM "1" "2025-01-30" "pdfjam 4.3.1" "User Commands" |
| 2 |
.SH "NAME" |
| 3 |
pdfjam \- A shell script for manipulating PDF files |
| 4 |
.SH "SYNOPSIS" |
| 5 |
.B pdfjam |
| 6 |
[\fI\,options\/\fR] [\fI\,--\/\fR] [\fI\,file\/\fR[\fI\,pages\/\fR]]... |
| 7 |
.SH "DESCRIPTION" |
| 8 |
pdfjam assembles a list of documents (pdf, ps, eps, jpg or png) |
| 9 |
into a single pdf. |
| 10 |
It allows to rotate, scale, reorder and combine pages freely |
| 11 |
using the power of the 'pdfpages' and 'graphicx' LaTeX packages. |
| 12 |
.PP |
| 13 |
Output is written to a generated name (unless specified via \fB\-\-outfile\fR). |
| 14 |
The input files are embedded as graphics in the output. |
| 15 |
Especially jpg files are kept as is without transcoding. |
| 16 |
Input from stdin is supported by specifying \fI\,/dev/stdin\/\fP as a file and |
| 17 |
is the default if no file is given. |
| 18 |
.PP |
| 19 |
By specifying \fI\,pages\/\fP it is possible to specfiy |
| 20 |
which pages to include in which order. |
| 21 |
The default '\-' selects all pages. |
| 22 |
An example: |
| 23 |
.IP |
| 24 |
pdfjam file1 '{},2,4\-6,9\-' ... |
| 25 |
.PP |
| 26 |
makes an empty page, followed by pages 2,4,5,6 of file1, followed by pages |
| 27 |
9 onwards (up to the end of file1). |
| 28 |
.PP |
| 29 |
A page selection can be applied to more than one file, e.g., |
| 30 |
.IP |
| 31 |
pdfjam file1 file2 file3 last\-1 ... |
| 32 |
.PP |
| 33 |
applies page selection 'last\-1' (reverting the page order) to all three files; |
| 34 |
but for example |
| 35 |
.IP |
| 36 |
pdfjam file1 file2 2\- file3 1\-7 ... |
| 37 |
.PP |
| 38 |
would apply the page selection '2\-' to file1 and file2, and '1\-7' to file3. |
| 39 |
A page selection applies to all the files *immediately* preceding it in the |
| 40 |
argument list. |
| 41 |
.PP |
| 42 |
See the pdfpages manual for more details on pagespec syntax. |
| 43 |
.SH "OPTIONS TO PDFPAGES AND GRAHPICX" |
| 44 |
Key value options to 'pdfpages' and 'graphicx' can be specified as |
| 45 |
\fI\,\-\-key value\,\fP. |
| 46 |
.SH "META OPTIONS" |
| 47 |
.TP |
| 48 |
\fB\-h\fR, \fB\-\-help\fR |
| 49 |
Output this text only; no processing of PDF files. |
| 50 |
.TP |
| 51 |
\fB\-\-configpath\fR |
| 52 |
Output the 'configpath' variable and exit immediately; |
| 53 |
no processing of PDF files. |
| 54 |
.TP |
| 55 |
\fB\-V\fR, \fB\-\-version\fR |
| 56 |
Output the version number of pdfjam and exit immediately; |
| 57 |
no processing of PDF files. |
| 58 |
.TP |
| 59 |
\fB\-q\fR, \fB\-\-quiet\fR |
| 60 |
Suppress verbose commentary on progress. |
| 61 |
.SH "PROCESSING OPTIONS" |
| 62 |
.TP |
| 63 |
\fB\-\-batch\fR |
| 64 |
Run pdfjam sequentially on each input file in turn, and produce a separate |
| 65 |
output file for each input, rather than the default coalescing behaviour. |
| 66 |
For the location of output files, see \fB\-\-outfile\fR. |
| 67 |
The \fB\-\-batch\fR option cannot be used in the case of input from stdin. |
| 68 |
.TP |
| 69 |
\fB\-o\fR, \fB\-\-outfile\fR name |
| 70 |
Specifies where the output file(s) will go. |
| 71 |
If 'name' is an existing directory, pdfjam will attempt to write its output PDF |
| 72 |
file(s) there, with name(s) derived from the input file name(s) and the |
| 73 |
\fB\-\-suffix\fR option (see below). |
| 74 |
Otherwise the output pdf will be written at 'name'. |
| 75 |
.TP |
| 76 |
\fB\-\-suffix\fR string |
| 77 |
Specifies a suffix for output file names, to be used when \fB\-\-outfile\fR is |
| 78 |
unspecified or a directory. |
| 79 |
The STRING must not have zero length. |
| 80 |
.TP |
| 81 |
\fB\-\-checkfiles\fR, \fB\-\-no\-checkfiles\fR |
| 82 |
If the Unix 'file' utility is available, the output of 'file \fB\-Lb\fR FILE1' |
| 83 |
should be 'PDF document...' where '...' gives version information. |
| 84 |
If this is the case on your system you should use \fB\-\-checkfiles\fR; |
| 85 |
otherwise use \fB\-\-no\-checkfiles\fR, in which case all input files must have |
| 86 |
the correct extensions (.pdf, .ps, .eps .jpg, .jpeg, .png, or their uppercase |
| 87 |
variants). |
| 88 |
.TP |
| 89 |
\fB\-\-latex\fR pathtolatex |
| 90 |
Specify the LaTeX engine to be used (one of pdflatex, xelatex, lualatex). |
| 91 |
The pathtolatex string must be the full path to a suitable LaTeX executable (for |
| 92 |
example \fI\,/usr/bin/xelatex\/\fP on many unix systems). |
| 93 |
.TP |
| 94 |
\fB\-\-tidy\fR, \fB\-\-no\-tidy\fR |
| 95 |
Specify whether the temporary directory created by pdfjam should be deleted. |
| 96 |
Use '\-\-no\-tidy' or '\-\-builddir' (see below) to help debug most errors. |
| 97 |
.TP |
| 98 |
\fB\-\-builddir\fR path |
| 99 |
Specifies a build directory to be used in place of a temporary one. |
| 100 |
Existing files inside will be overwritten. |
| 101 |
Overrides \fB\-\-tidy\fR. |
| 102 |
.TP |
| 103 |
\fB\-\-runs\fR N |
| 104 |
Run latex N times, for each output document made. |
| 105 |
.TP |
| 106 |
\fB\-\-vanilla\fR |
| 107 |
Suppress the reading of any pdfjam configuration files. |
| 108 |
.TP |
| 109 |
\fB\-\-enc\fR |
| 110 |
Specify a command\-line encoding |
| 111 |
.SH "PAPER OPTIONS" |
| 112 |
.TP |
| 113 |
\fB\-\-paper\fR papername, \fB\-\-papername\fR |
| 114 |
.IP |
| 115 |
Specify a LaTeX paper size, for example '\-\-paper a4' or simply '\-\-a4paper' |
| 116 |
for ISO A4 paper. |
| 117 |
A wide range of paper sizes is available thanks to the LaTeX 'geometry' package. |
| 118 |
For details see documentation for LaTeX and/or the 'geometry' package. |
| 119 |
If no default value is set, obtain the system’s default paper |
| 120 |
via libpaper, falling back to A4. |
| 121 |
.TP |
| 122 |
\fB\-\-papersize\fR width,height |
| 123 |
Specify a custom paper size in points = 1/72 inch (known as bp in LaTeX and as |
| 124 |
pt in other software), e.g.\& \fB\-\-papersize\fR 612,792. |
| 125 |
Units may also be specified explicitly, e.g.\& \fB\-\-papersize\fR 10in,18cm. |
| 126 |
.TP |
| 127 |
\fB\-\-landscape\fR, \fB\-\-no\-landscape\fR |
| 128 |
Specify landscape page orientation (or not) in the output PDF file. |
| 129 |
.TP |
| 130 |
\fB\-\-twoside\fR, \fB\-\-no\-twoside\fR |
| 131 |
Specify (or not) the 'twoside' document class option. |
| 132 |
.TP |
| 133 |
\fB\-\-other\-edge\fR, \fB\-\-no\-other\-edge\fR |
| 134 |
Rotate every odd page by 180 degrees (or not). |
| 135 |
Thus changes along which edge the pages are flipped in duplex printing. |
| 136 |
.TP |
| 137 |
\fB\-\-pagecolor\fR rgbspec |
| 138 |
Specify a background colour for the output pages. |
| 139 |
The RGBSPEC must be a comma\-separated triple of integers between 0 and 255. |
| 140 |
An example: |
| 141 |
\fB\-\-pagecolor\fR 150,200,150. |
| 142 |
Default is no background colour. |
| 143 |
.SH "PDFINFO OPTIONS" |
| 144 |
.TP |
| 145 |
\fB\-\-keepinfo\fR, \fB\-\-no\-keepinfo\fR |
| 146 |
Preserve (or not) Title, Author, Subject and Keywords |
| 147 |
(from the last input PDF file, if more than one) in the output PDF file. |
| 148 |
This requires the pdfinfo utility, from the poppler-utils package, and the |
| 149 |
LaTeX 'hyperref' package; if either of those is not available, '\-\-keepinfo' is |
| 150 |
ignored. |
| 151 |
.TP |
| 152 |
\fB\-\-pdftitle\fR string, \fB\-\-pdfauthor\fR string, |
| 153 |
\fB\-\-pdfsubject\fR string, \fB\-\-pdfkeywords\fR string |
| 154 |
Provide text for the Title, Author, Subject and Keywords in the output PDF file. |
| 155 |
Requires the LaTeX 'hyperref' package. |
| 156 |
These options, individually, override \fB\-\-keepinfo\fR. |
| 157 |
.SH "ADVANCED OPTIONS" |
| 158 |
.TP |
| 159 |
\fB\-\-preamble\fR string |
| 160 |
Append the supplied STRING to the preamble of the LaTeX |
| 161 |
source file(s), immediately before the '\ebegin{document}' |
| 162 |
line to load LaTeX packages or set global options. |
| 163 |
An example: |
| 164 |
.IP |
| 165 |
pdfjam \fB\-\-nup\fR 2x2 myfile.pdf \fB\-o\fR myfile\-4up.pdf |
| 166 |
\fB\-\-preamble\fR '\eusepackage{fancyhdr} \epagestyle{fancy}' |
| 167 |
.PP |
| 168 |
If '\-\-preamble' is used more than once in the call, |
| 169 |
the supplied preamble strings are concatenated. |
| 170 |
For a note on avoiding clashes, see the README file, |
| 171 |
also available at https://github.com/pdfjam/pdfjam. |
| 172 |
.TP |
| 173 |
\fB\-\-\fR |
| 174 |
Signals end of options processing. |
| 175 |
.SH "PDFPAGES AND GRAPHICX OPTIONS" |
| 176 |
.TP |
| 177 |
\fB\-\-KEY\fR VALUE |
| 178 |
Specify options to '\eincludepdfmerge', in the LaTeX 'pdfpages' package. |
| 179 |
See the the pdfpages documentation (usually 'texdoc pdfpages') for more |
| 180 |
information. |
| 181 |
Here KEY is the name of any of the many options for '\eincludepdfmerge', |
| 182 |
and VALUE is a corresponding value. |
| 183 |
Examples: |
| 184 |
.IP |
| 185 |
\fB\-\-nup\fR 2x1 |
| 186 |
(for 2\-up side\-by\-side imposition) |
| 187 |
.IP |
| 188 |
\fB\-\-scale\fR 0.7 |
| 189 |
(to scale all input pages to 70% size) |
| 190 |
.IP |
| 191 |
\fB\-\-offset\fR '1cm 0.5cm' |
| 192 |
(to offset all pages \fB\-\-\fR note the quotes!) |
| 193 |
.IP |
| 194 |
\fB\-\-frame\fR true |
| 195 |
(to put a frame round each input page) |
| 196 |
.IP |
| 197 |
\fB\-\-booklet\fR true |
| 198 |
(to reorder the pages in signatures, generally useful with \fB\-\-nup\fR) |
| 199 |
.IP |
| 200 |
\fB\-\-signature\fR N (specify the signature size, as the number of original |
| 201 |
pages in a signature in the final document. |
| 202 |
Caveat: booklet is a short form for signature, so if you use |
| 203 |
\fB\-\-booklet true\fR, signature will be ignored) |
| 204 |
.IP |
| 205 |
\fB\-\-trim\fR '1cm 2cm 1cm 2cm' \fB\-\-clip\fR true |
| 206 |
(to trim those amounts from left, bottom, right and top, respectively, of input |
| 207 |
pages) |
| 208 |
.IP |
| 209 |
\fB\-\-angle\fR NNN |
| 210 |
(The angle of rotation in degrees. |
| 211 |
Angles that are not either 0, 90, 180 or 270 will still create straight |
| 212 |
rectangular pages, only the content will be rotated.) |
| 213 |
.SH "CONFIGURATION FILES" |
| 214 |
Defaults for the options |
| 215 |
\fB\-\-suffix\fR, |
| 216 |
\fB\-\-keepinfo\fR, |
| 217 |
\fB\-\-paper\fR, |
| 218 |
\fB\-\-outfile\fR, |
| 219 |
\fB\-\-landscape\fR, |
| 220 |
\fB\-\-twoside\fR, |
| 221 |
\fB\-\-tidy\fR, |
| 222 |
\fB\-\-latex\fR, |
| 223 |
\fB\-\-runs\fR, |
| 224 |
\fB\-\-checkfiles\fR and |
| 225 |
\fB\-\-preamble\fR |
| 226 |
can be set in site\-wide or user\-specific configuration files. |
| 227 |
The files searched are |
| 228 |
.IP |
| 229 |
/etc/pdfjam.conf |
| 230 |
/usr/share/etc/pdfjam.conf |
| 231 |
/usr/local/share/pdfjam.conf |
| 232 |
/usr/local/etc/pdfjam.conf |
| 233 |
$XDG_CONFIG_HOME/pdfjam.conf |
| 234 |
$HOME/.pdfjam.conf |
| 235 |
.PP |
| 236 |
This list can be changed by editing 'configpath' in the pdfjam script. |
| 237 |
All of these files are ignored if the \fB\-\-vanilla\fR argument is used. |
| 238 |
.SH "AUTHORS" |
| 239 |
David Firth (2002 to 2019), |
| 240 |
Reuben Thomas (2020 to 2024), |
| 241 |
Markus Kurtz (since 2024) |
| 242 |
.SH "SEE ALSO" |
| 243 |
The LaTeX packages graphicx (https://ctan.org/pkg/graphicx) |
| 244 |
and pdfpages (https://ctan.org/pkg/pdfpages). |
| 245 |
For including eps files, see the epstopdf package |
| 246 |
(https://ctan.org/pkg/epstopdf). |
| 247 |
.PP |
| 248 |
For more information, including a sample configuration file, see |
| 249 |
https://github.com/pdfjam/pdfjam. |