Spliting a PDF file in two at specific page number

15 hours ago

To split a single PDF into two separate files using the Ghostscript (gs) command line, you need to run the command twice: once to extract the first set of pages and once for the second set.

Create the first part (Pages 1 to 10):


gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFirstPage=1 -dLastPage=10 -sOutputFile=part1.pdf input.pdf


Create the second part (Pages 10 to 20):


gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFirstPage=N+1 -sOutputFile=part2.pdf input.pdf