noxz-sites

A collection of a builder and various scripts creating the noxz.tech sites
git clone https://noxz.tech/git/noxz-sites.git
Log | Files | README | LICENSE

noxz.tech/articles/concatenating_pages_with_pdftk/index.www
1.B PDFTK
2(PDF Toolkit) is a command-line tool that allows users to manipulate PDF
3files in various ways, including combining, splitting, and modifying PDF
4documents. This article focuses on using PDFTK to concatenate a range of
5pages from one or more PDF files into a new PDF file.
6
7.HnS 1
8Overview
9.HnE
10
11Concatenation is the process of merging multiple PDF files or a range of pages
12from one or more PDF files into a single PDF document. PDFTK simplifies this
13task with a straightforward command-line interface. The resulting PDF file
14retains the original order of pages, allowing for various use cases such as
15merging chapters of a book, assembling reports, or creating custom
16presentations.
17
18
19.HnS 1
20Concatenating Pages
21.HnE
22
23To concatenate a range of pages from one or more PDF files into a new PDF file,
24follow these steps:
25
26.DLS
27.LI "Open the Terminal or Command Prompt:"
28Launch your system's terminal or command prompt. Ensure that PDFTK is installed
29and available in your system's PATH.
30
31.LI "Use the `cat` Command:"
32The
33.ICD cat
34command is used to concatenate pages. The basic syntax for concatenating PDF
35files or pages is as follows:
36
37.CDS
38.COS
39pdftk file1.pdf file2.pdf cat output output.pdf
40.COE
41.CDE
42
43Replace
44.ICD file1.pdf ,
45.ICD file2.pdf ,
46and
47.ICD output.pdf
48with the appropriate file names and paths. This command concatenates
49.ICD file1.pdf
50and
51.ICD file2.pdf
52into a new PDF file called
53.ICD output.pdf .
54
55.LI "Concatenate Specific Pages:"
56To concatenate specific pages from a source PDF file, use the
57.ICD cat
58command with a range specification. For example, to concatenate pages 3 to 6
59from
60.ICD source.pdf ,
61use the following command:
62
63.CDS
64.COS
65pdftk source.pdf cat 3-6 output output.pdf
66.COE
67.CDE
68
69This command concatenates pages 3 to 6 from
70.ICD source.pdf
71into a new PDF file called
72.ICD output.pdf .
73
74.LI "Concatenate Multiple Ranges:"
75You can concatenate multiple ranges of pages from a single PDF file or from
76multiple PDF files into the same output file. For example:
77
78.CDS
79.COS
80pdftk A=source1.pdf B=source2.pdf cat A1-3 B4-6 A4 output output.pdf
81.COE
82.CDE
83
84This command concatenates pages 1 to 3 from
85.ICD source1.pdf
86and pages 4 to 6 from
87.ICD source2.pdf
88and page 4 from
89.ICD source1.pdf
90into a new PDF file called
91.ICD output.pdf .
92.DLE
93
94.HnS 1
95Conclusion
96.HnE
97
98PDFTK is a powerful tool for concatenating pages from one or more PDF file
99into a new PDF document. Whether you need to merge chapters of a book, assemble
100a report, or create custom presentations, PDFTK provides a convenient and
101efficient way to perform these tasks. With the ability to specify page ranges,
102you have full control over the content you want to include in the final
103document.