Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

Chris Rodgers wrote a Perl script to split a PDF file into colour and black/white pages. The script is available here.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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