# Device Independent color

I am validating the following latex document with The 3-Heights™ PDF Validator Online Tool

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[rgb]{xcolor}

\begin{document}
\textcolor{blue}{This is only a test}
\end{document}


The output gives the error:

A device-specific color space (DeviceRGB) without an appropriate output intent is used.

How can I use colors that aren't device specific? Or use the appropriate intent?

• The xcolor package lets you chose the color model, including device independent one. – mafp Jan 29 '13 at 1:07
• @mafp I reviewed the documentation provided, which did mention driver-independent access to colors. Which color model is device independent(gray, rgb, HTML, etc.)? – Ryan Gates Jan 29 '13 at 1:25
• I think it is already best explained here: tex.stackexchange.com/a/9973/21591. – mafp Jan 29 '13 at 9:18
• @mafp I agree that it has been explained there and in the pdf documentation. I was unable to find a working example that I could use for this scenario. – Ryan Gates Jan 30 '13 at 1:17

Generating PDFA-1b compatible PDFs is rather difficult with LaTeX. The details are described here: http://support.river-valley.com/wiki/index.php?title=Generating_PDF/A_compliant_PDFs_from_pdftex

If it is just about the color profile, you may use the following piece of code:

\pdfminorversion=4
\documentclass{minimal}
\usepackage[rgb]{xcolor}

\immediate\pdfobj stream attr{/N 3}  file{sRGBIEC1966-2.1.icm}
\pdfcatalog{%
/OutputIntents [ <<
/Type /OutputIntent
/S/GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (sRGB IEC61966-2.1)
/Info(sRGB IEC61966-2.1)
>> ]
}

\begin{document}
\textcolor{blue}{This is only a test}
\end{document}


The file sRGBIEC1966-2.1.icm is the color profile you want to use. Please put this file into the same directory your tex document is, so it can be found by pdftex. If you want to make your PDF even more PDFA-1b compliant, you may want to have a look at the pdfx package which has an option for PDFA-1b, too.

http://ctan.org/tex-archive/macros/latex/contrib/pdfx/

Please note that PDFs generated by pdftex are not PDFA compatible due to wrong EOL markers.

Update: I just added a complete example that works just fine for me. Please note that I use PDF version 1.4 to prevent compressed streams.

Update2: You can download color profiles from here:

and here (SRGB) http://www.color.org/srgbprofiles.xalter

• I tried adding the above code between the \usepackage and \begin, but then I got the error referred to in tex.stackexchange.com/q/71224/17290 – Ryan Gates Feb 24 '13 at 21:33
• Are you sure you have the color profile in the same directory of your tex document? – user26372 Feb 24 '13 at 22:15
• Wow, amazing. Never saw anything like that. So for a given file, how do I get the exact string that is "sRGB IEC61966-2.1" in this example? Any idea? – Christian Feb 24 '13 at 22:33
• It worked for me, but what is the significance of changing /N 4 to /N 3? – Ryan Gates Feb 27 '13 at 2:18
• You can find it in the PDF specs: "The number of color components in the color space described by the ICC profile data. This number must match the number of components actually in the ICC profile. As of PDF 1.4, N must be 1, 3, or 4." – user26372 Feb 27 '13 at 11:09