Subscribe to
Posts
Comments

The pdfcolour utility allows one to split a PDF file apart to give two separate PDFs, one containing the colour pages and the other containing the B&W pages. That way, one can easily print the B&W pages on a faster, cheaper printer and reassemble the document by hand.

Instructions:

Download the pdfcolour-1.2.tgz file.
Extract it using tar -xzf pdfcolour-1.2.tgz
Recompile if necessary using the command “make”.
Run on a PDF with splitcolour input.pdf bw.pdf colour.pdf

This program has been tested on Linux (Fedora 10) and Cygwin (Vista x64).

For our American friends, this program will split a PDF into separate color and black/white files.

13 Responses to “Split a PDF into separate files containing colour and B&W pages”

  1. on 13 Nov 2007 at 11:50 pmCarlos P

    Yo, this is exactly what I’m looking for to split my thesis in colour / BW stuff. Thanks and we will see how it works!

    Carlos

  2. on 14 Nov 2007 at 12:18 amCarlos P

    Actually it did not create the files, but I needed only the list of color/BW pages to give it to the guys printing the thesis. That worked though.

  3. on 22 Feb 2008 at 4:58 amchristophe

    Hi,

    Is there a way to run the program on windows XP?

    Kind regards,

    Christophe

  4. on 09 May 2009 at 11:49 amme

    - 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.

    Does not compile with
    gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)

    Sorry, not a clue about Perl so if anyone tries to get this going for Ubuntu, you’re on your own.
    Look for unstuff to extract joinPDF from its MAC installer.

    Also I’m really looking for a way to split black and color into two pdfs so I can run the stack through a laser and then inkjet the images on, so I’m out.. :-)

  5. on 09 May 2009 at 11:52 amme

    I forgot to mention “pdftk” as alternative to “joinPDF”.

  6. on 16 Aug 2009 at 2:31 pmJulien

    Chris, this tool sounds great but I haven’t been able to use it. When I run it I get the error below. Do you know how to fix it?

    Thanks a lot!

    Exception in thread “main” java.lang.NoClassDefFoundError: Split
    Caused by: java.lang.ClassNotFoundException: Split
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: Split. Program will exit.
    Exception in thread “main” java.lang.NoClassDefFoundError: Concat
    Caused by: java.lang.ClassNotFoundException: Concat
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: Concat. Program will exit.
    cp: cannot stat `/tmp/splitcolour-9dWqXOW3/colour.pdf’: No such file or directory
    Exception in thread “main” java.lang.NoClassDefFoundError: Concat
    Caused by: java.lang.ClassNotFoundException: Concat
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: Concat. Program will exit.
    cp: cannot stat `/tmp/splitcolour-9dWqXOW3/bw.pdf’: No such file or directory

  7. on 17 Aug 2009 at 11:32 amchris

    Hi Julien,

    Sorry, I forgot to add an instruction to the README file.

    You need to edit the path in joinPDF and splitPDF from

    joinPDF:java -cp /home/stieltjes-p/rodgers/bin/PDF.jar Concat “$@”
    splitPDF:java -cp /home/stieltjes-p/rodgers/bin/PDF.jar Split “$@”

    to refer instead to the location where you have put the PDF.jar file.

    C.

  8. on 17 Aug 2009 at 6:04 pmchris

    I’ve now updated the package available here. It should no longer contain this hard coded path.

  9. on 03 Nov 2009 at 1:05 pmVictoria Lee

    Hi

    I need to scan a document containing a mixture of colour and black pages. The black pages need to be black only in the PDF, not a mixture of CMYK or when they are printed on a colour printer, they will be printed using a mixture of CMYK toner, not just black toner.

    Any ideas?

    Thanks

  10. on 03 Nov 2009 at 1:12 pmchris

    Dear Victoria,

    My program won’t help you with this, but I’m sure you can use a similar idea by writing a program that classifies pages as “black” if they have less than some threshold amount of other colours in the scans.

    Judging by your email address, your colleagues probably know far more about this than I do!

    With best wishes,

    Chris.

  11. on 19 Feb 2010 at 6:04 amIain

    If anyone has trouble with pdfcolour, they could try my attempt, which doesn’t need compiling, but does require both pdftk and gs to be installed:
    http://www.cs.toronto.edu/~murray/code/#pdfcolorsplit

  12. on 20 Jan 2011 at 5:34 amJason Youmans

    Thanks for the great tool. I looked through many commercial prepress solutions and could not find anything close to this functionality. BTW, if anyone needs to run this tool in a high volume/batch mode with a need to suppress the gs output, simply add the following to the list of gs arguments (in pdfcolor.c):

    gsargv[4] = “-dQUIET”;

    You then have to adjust all subsequent indexes since arg4 is injected after arg3.

  13. on 20 Dec 2011 at 4:00 pmEd

    Thanks for a great script. Can you tell me why I get this error?
    Unrecoverable error: typecheck in .Putdeviceprops

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image