Split PDF into colour and black/white pages

pdf

I would like to automatically split a large PDF document into two files: one file should contain only the pages with black and white content, and the other should contain only the pages with any colour content. The colour and black/white pages do not run contiguously — they are interspersed throughout the document. How can I do this automatically?

Best Answer

Chris Rodgers wrote a Perl script to split a PDF file into colour and black/white pages. Here is the link to the script: pdfcolor-1.2.tgz.

Detailed explanation of how the script works from the website:

- Perl script
- uses:
– “pscolor” (C, “using GS DLL as a ps colorpage separator”) by Carsten Hammer
– “joinPDF” (Java, “Command line tool to join and split PDF files”, for mac) by Gerard Briscoe
- Has hardcoded paths in shell scripts “splitPDF” and “joinPDF”
- Depends on flex
- Depends on libgs-dev
- GNU GPL 2.0

How it works:
split PDF into single pages in temporary location
use pscolor to detect whether color is on the page
reassemble pages with color and pages without color into two pdf files.

Does not work when adjusting said hardcoded paths.
Related Question