Graphics Programs Reference
In-Depth Information
Merging Documents
To merge documents, we use the
cat
operation. This is the default operation, so we
don't actually need to specify the
cat
keyword. For example, to merge the pages of
three files into one, in order, we need:
pdftk file1.pdf file1.pdf file3.pdf output output.pdf
This writes a new file to
output.pdf
containing all the pages of
file1.pdf
,
file2.pdf
, and
file3.pdf
, in order. The output file may not be the same as any of the input files.
Pdftk
allows us to choose which pages are taken from each document, and what the
viewing rotation of each output page is. Such
page ranges
are used by listing them in
order after the inputs. For example:
pdftk file1.pdf file2.pdf 1-5 even output out.pdf
takes pages one to five inclusive from
file1.pdf
and pages two, four, six… from
file2.pdf
.
Page ranges in pdftk
A page range contains up to five parts:
• The input PDF
handle
, e.g.,
B
. This is discussed below.
• The beginning page number.
• Optionally a dash, followed by the ending page number.
• An optional qualifier (
even
or
odd
), which modifies the page range already given.
• The page rotation:
—
N
(set rotation to 0°)
—
E
(set rotation to 90°)
—
S
(set rotation to 180°)
—
W
(set rotation to 270°)
—
L
(rotate by -90°)
—
R
(rotate by +90°)
—
D
(rotate by +180°)
Either page number can be
end
to refer to the last page of a document. The beginning
page number can be larger than the ending page number (the pages will be taken in
reverse order).
For example:
•
3
(page three only)
•
1-6
(pages one to six only)
•
1,4,5-end
(page one, page four, and all pages from page five onwards)
•
end-1
(all pages in reverse order)