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?

  • What is the actual reason to split it? Are you going to print it on two different printers? – Serge Feb 20 '13 at 12:05
  • @Serge: Correct. – SabreWolfy Feb 20 '13 at 12:15
  • Maybe this imagemagick.org/Usage/compare/#type_greyscale – frostschutz Feb 20 '13 at 14:08
  • 1
    @SabreWolfy - you might want to check this question on so which is nearly identical. I've successfully used both sh scripts from the answers several times. – don_crissti Apr 6 '13 at 1:41

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.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.