[Tex/LaTex] Store black and white information in a generated pdf

colorpdfprinting

Last time when I printed my thesis at a copy shop the nice girl asked me if my pdf has some kind of color information stored inside. She explained to me that their printers can detect black and white pages and print them without using any color. Unfortunately my pdf which was generated using pdflatex (MikTeX, now I'm on macTeX) did not provide the information if a page uses any color (every page was detected as colored). Now my question is: How can I provide this information? Is there any option I have to use when generating my pdf?

I'm asking because the price of a black and white page is one-tenth of a colored page. This makes a huge difference when printing 150+ pages.

Colored pages should stay colored so black and white only is not an option.


I printed my thesis (created with macTeX) yesterday and every text page was recognized correctly as being b/w only. However every page with a figure was detected colored although the figure were b/w only. Now what's the problem? Is there any option for figure to give pdfLaTeX a hint?

According to pixelmator the png image (which was created with the osx snapshot tool from a pdf) is using the rgb profile with depth of 8. Profile Name is Colored LCD (I've no idea what I'm talking about ;)):

pixelmator image info

Best Answer

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