cpdf -merge in1.pdf [<range>] in2.pdf [<range>] [<more names/ranges>] [-retain-numbering] [-remove-duplicate-fonts] [-merge-add-bookmarks] [-merge-add-bookmarks-use-titles] -o out.pdf
cpdf -split in.pdf -o <format> [-chunk <chunksize>]
cpdf -split-bookmarks <level> in.pdf -o <format>
The -merge operation allow the merging of several files into one. Ranges can be used to select only a subset of pages from each input file in the output. The output file consists of the concatenation of all the input pages in the order specified on the command line. Actually, the -merge can be omitted, since this is the default operation of cpdf.
cpdf -merge a.pdf 1 b.pdf 2-end -o out.pdf
Take page one of a.pdf and all but the first page of b.pdf, merge them and produce out.pdf.
Merge maintains bookmarks, named destinations, and name dictionaries.
Forms and other objects which cannot be merged are retained if they are from the document which first exhibits that feature.
The -retain-numbering option keeps the PDF page numbering labels of each document intact, rather than renumbering the output pages from 1.
The -remove-duplicate-fonts option ensures that fonts used in more than one of the inputs only appear once in the output.
The -merge-add-bookmarks option adds a top-level bookmark for each file, using the filename. Any existing bookmarks are retained. Adding -merge-add-bookmarks-use-titles will use the title from each PDF’s metadata instead of the filename.
The -split operation splits a PDF file into a number of parts which are written to file, their names being generated from a format. The optional -chunk option allows the number of pages written to each output file to be set.
cpdf -split a.pdf -o out%%%.pdf
Split a.pdf to the files out001.pdf, out002.pdf etc.
cpdf a.pdf even AND -split -chunk 10 -o dir/out%%%.pdf
Split the even pages of a.pdf to the files out001.pdf, out002.pdf etc. with at most ten pages in each file. The directory (folder) dir must exist.
Numbers padded to a fixed width field by zeroes may be obtained for @S and @E by following them with more @ signs e.g @E@@@ for a fixed width of three.
The -split-bookmarks <level> operation splits a PDF file into a number of parts, according to the page ranges implied by the document’s bookmarks. These parts are then written to file with names generated from the given format.
Level 0 denotes the top-level bookmarks, level 1 the next level (sub-bookmarks) and so on. So -split-bookmarks 1 creates breaks on level 0 and level 1 boundaries.
cpdf -split-bookmarks 0 a.pdf -o out%%%.pdf
Split a.pdf to the files out001.pdf, out002.pdf on bookmark boundaries.
cpdf -split-bookmarks 0 a.pdf -o @B.pdf
Split a.pdf on bookmark boundaries, using the bookmark text as the filename.
/ ? < > ' : * | " ˆ + =
The encryption parameters described in Chapter 4 may be added to the command line to encrypt each split PDF. Similarly, the -recrypt switch described in Chapter 1 may by given to re-encrypt each file with the existing encryption of the source PDF.