Ghostscript can convert color documents into grayscale. Example commandline:
gs \
-o grayscale.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \
-sProcessColorModel=/DeviceGray \
/path/to/your.pdf
The most recent version of Ghostscript can also check for the CMYK ink coverage of PDF documents (not image by image, but page by page), using a new "device" called inkcov
. Check for the ink coverage of an example PDF:
gs -o - -sDEVICE=inkcov /path/to/your.pdf
Example output:
Page 1
0.00000 0.00000 0.00000 0.02230 CMYK OK
Page 2
0.02360 0.02360 0.02360 0.02360 CMYK OK
Page 3
0.02525 0.02525 0.02525 0.00000 CMYK OK
Page 4
0.00000 0.00000 0.00000 0.01982 CMYK OK
Here 1.00000 would mean 100%, 0.02525 means 2.525% and 0.00000 means 0% ink coverage. You can see here that pages 1+4 are using no color, while pages 2+3 do. This case is particularly 'nasty' for people who want to save on color ink: because all the C, M, Y (and K) values are exactly the same for each of the pages 2+3, they possibly could appear to the human eye not as color pages, but as grayscale (or "rich" grayscale in the case of page 3) anyway. (That is, if each single pixel is mixed with these color values -- of course, if the page is made by four different squares of the same size using "pure" colors each, then you'd get the same ink coverage result).
Now convert the original PDF to a grayscale one, using the command I initially gave. Then check for the ink coverage distribution again (note how the addition of -q
to the parameters slightly changes the output format):
gs -q -o - -sDEVICE=inkcov grayscale.pdf
0.00000 0.00000 0.00000 0.02230 CMYK OK
0.00000 0.00000 0.00000 0.02360 CMYK OK
0.00000 0.00000 0.00000 0.02525 CMYK OK
0.00000 0.00000 0.00000 0.01982 CMYK OK
There are many ways for detecting "color" in PDF pages. Without the knowledge of the exact method of the printer, guessing and experimenting remain.
It would help to have a PDF file for analyzing, whose pages are correctly classified by the printer as black and colored pages.
If you want to experiment (and spend some money), a guess with experiment follows.
LaTeX test
Usually the gray color model is used for black in LaTeX:
\definecolor{black}{gray}{0}
If the printer has problems with this color model and thinks, this is color (maybe because of an odd translation to CMYK), then the following file for pdfTeX could be used to test the theory:
\documentclass{article}
\pagestyle{empty}
\usepackage{color}
\definecolor{black}{cmyk}{0,0,0,1}
\makeatletter
\expandafter\let\expandafter\current@color
\csname\string\color @black\endcsname
\chardef\main@pdfcolorstack
\pdfcolorstackinit page direct\expandafter{\current@color}\relax
\makeatother
\begin{document}
CMYK-Black
\newpage
Gray: \textcolor[gray]{.5}{Gray}
\newpage
CMYK-Gray: \textcolor[cmyk]{0,0,0,.5}{Gray}
\end{document}
It changes the definition for black to the CMYK color model.
The first page only contains black in CMYK ([cmyk]{0,0,0,1}
).
The second page adds gray in the gray colormodel ([gray]{.5}
) and the third page uses the same gray in CMYK ([cmyk]{0,0,0,.5}
).
Plain TeX test
The following test file tests black in different color models:
\pdfobjcompresslevel=0
\pdfcompresslevel=0
\nopagenumbers
\bf
Pure black
\par\vfill\eject
\pdfliteral direct{0 g 0 G}Gray black
\par\vfill\eject
\pdfliteral direct{0 0 0 rg 0 0 0 RG}RGB black
\par\vfill\eject
\pdfliteral direct{0 0 0 1 k 0 0 0 1 K}CMYK black
\bye
It is has to be compiled with pdftex
, not pdflatex
. Except for the first page, there is one color instruction on the page exactly. The color is given as LaTeX color expression:
- Page 1: no color instructions (the printer should report as black page).
- Page 2:
\color[gray]{0}
- Page 3:
\color[rgb]{0,0,0}
- Page 4:
\color[cmyk]{0,0,0,1}
In theory, color is not used at all in all pages, the text is always "black".
It would give some hints, if the printer classifies one or some of the pages as "colored".
Best Answer
Newer versions of Ghostscript (version 9.05 and later) include a "device" called
inkcov
. It calculates the ink coverage of each page (not for each image) in Cyan (C), Magenta (M), Yellow (Y) and Black (K) values, where 0.00000 means 0%, and 1.00000 means 100%.Example commandline:
Example output:
You can see here that the pages 1+4 are using no color, while pages 2+3 do. This case is particularly 'nasty' for people who want to save on color ink: because all the respective C, M, Y (and K) values are exactly the same for each of the pages 2+3, they possibly could appear to the human eye not as color pages, but as ("rich") grayscale anyway (if each single pixel is mixed with these color values).
Ghostscript can also convert color into grayscale. Example commandline:
Checking for the ink coverage distribution again (note how the addition of
-q
to the parameters slightly changes the output format):