pdfcpu

Logo

PDF tooling for Go and the command line.

View the Project on GitHub pdfcpu/pdfcpu


Changelog
Future Directions

Split

Generate a set of PDF files for inFile in outDir according to given span value. Also check out the extract pages command which gives you similar functionality. Have a look at some examples.

Usage

pdfcpu split inFile outDir [ span | pageNr... ] [flags]

Flags

namerequiredvaluedescription
m(ode)nospanSplit into PDF files with span pages each (default).
bookmarkSplit into PDF files representing sections defined by existing bookmarks.
pageSplit before specific page number(s).

Common Flags


Arguments

namedescriptionrequireddefault
inFilePDF input file, use - to read from stdinyes
outDiroutput directoryyes
spansplit span in pagesno1

Restrictions

The following PDF elements are not carried over into the output files:


Examples

Split a PDF file into single page PDF files in out:

$ pdfcpu split test.pdf out

Split a PDF file into individual PDF files for every sheet of paper. Every PDF output file in out spans 2 pages of the original:

$ pdfcpu split test.pdf out 2

Split a PDF file along its bookmarks:

$ pdfcpu split test.pdf out -m bookmark

Split a PDF file before pages 2,4,10:

$ pdfcpu split -m page test.pdf out 2 4 10

Split selected pages from a PDF streamed from S3 into a local output directory:

$ aws s3 cp s3://acme-print/board-pack.pdf - \
   | pdfcpu split -m page - ./board-pack 10 25