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.
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
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.
Hi,
Is there a way to run the program on windows XP?
Kind regards,
Christophe
– 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.. 🙂
I forgot to mention “pdftk” as alternative to “joinPDF”.
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
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.
I’ve now updated the package available here. It should no longer contain this hard coded path.
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
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.
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
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.
Thanks for a great script. Can you tell me why I get this error?
Unrecoverable error: typecheck in .Putdeviceprops
Pingback: » Linux: Split PDF into colour and black/white pages
Pingback: Create plain CSV list of pages with/without figures – oraerr.com