# PDF/A with CMYK, how?

Using https://tex.stackexchange.com/a/99666 and https://tex.stackexchange.com/a/136653 I think I have been able to generate (using TeX Live 2014, pdfTeX 3.14159265-2.6-1.40.15) a PDF/A-1b compliant pdf as:

\documentclass{article}
\pdfminorversion 4
\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)
>> ]
}
\usepackage{xcolor}
\usepackage{hyperxmp}
\usepackage[pdftex, pdfa]{hyperref}
\hypersetup{%
pdfauthor          = {a},
pdfkeywords        = {a, b, c},
pdflang            = {en},
pdftitle           = {a},
pdfsubject         = {a},
pdfcaptionwriter   = {a},
pdfcontactcity     = {a},
pdfcontactcountry  = {a},
pdfcontactemail    = {a},
pdfmetalang        = {en}
}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\section {A}
{\color{blue}Hello} World!
$1+2=3$

\section {B}
\lipsum
$$1+2=3$$
\begin{align*}
A &= B\\
&= C\\
&= E
\end{align*}

\newpage

\section {C}
\lipsum
$1+2=3$
\end{document}


At least, PDFBox Preflight (http://en.wikipedia.org/wiki/Apache_PDFBox) says

The file test.pdf is a valid PDF/A-1b file


And also 3-Heights PDF Validator Online Tool (http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx) is happy.

Now, I would like to use CMYK-colors. So I downloaded an icc profile from http://www.eci.org/en/downloads and tried this modification:

\documentclass{article}
\pdfminorversion 4
\immediate\pdfobj stream attr{/N 4} file{ISOcoated_v2_eci.icc}
\pdfcatalog{%
/OutputIntents [ <<
/Type /OutputIntent
/S/GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (FOGRA39L)
/Info(FOGRA39L)
>> ]
}
\usepackage[cmyk]{xcolor}
\usepackage{hyperxmp}
\usepackage[pdftex, pdfa]{hyperref}
\hypersetup{%
pdfauthor          = {a},
pdfkeywords        = {a, b, c},
pdflang            = {en},
pdftitle           = {a},
pdfsubject         = {a},
pdfcaptionwriter   = {a},
pdfcontactcity     = {a},
pdfcontactcountry  = {a},
pdfcontactemail    = {a},
pdfmetalang        = {en}
}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\section {A}
{\color{blue}Hello} World!
$1+2=3$

\section {B}
\lipsum
$$1+2=3$$
\begin{align*}
A &= B\\
&= C\\
&= E
\end{align*}

\newpage

\section {C}
\lipsum
$1+2=3$
\end{document}


Now, PDFBox Preflight complains:

5.2.3 : Forbidden field in an annotation definition, Annotation uses a Color pro
file which isn't the same than the profile contained by the OutputIntent


And 3-Heights PDF Validator Online Tool says:

A device-specific color space (Annotation C or IC) without an appropriate output intent is used.
The document does not conform to the requested standard.
The document contains device-specific color spaces.


However, If I remove the tableofcontents a valid (according to PDFBox Preflight) PDF/A-1b seems to be generated.

What is the problem, and how do I fix it?

UPDATE:

The problem appears to be with hyperref. See the comments. Is it possible to redefine some part of hyperref to avoid the problems?

I would like something like this to work:

\documentclass{article}
\pdfminorversion 4
\pdfcompresslevel=0
\immediate\pdfobj stream attr{/N 4} file{ISOcoated_v2_eci.icc}
\pdfcatalog{%
/OutputIntents [ <<
/Type /OutputIntent
/S/GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (FOGRA39L)
/Info(FOGRA39L)
>> ]
}
\usepackage[cmyk]{xcolor}
\usepackage{hyperxmp}
\usepackage[pdftex, pdfa]{hyperref}
\hypersetup{%
pdfauthor          = {a},
pdfkeywords        = {a, b, c},
pdflang            = {en},
pdftitle           = {a},
pdfsubject         = {a},
pdfcaptionwriter   = {a},
pdfcontactcity     = {a},
pdfcontactcountry  = {a},
pdfcontactemail    = {a},
pdfmetalang        = {en},
}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsrefs}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\begin{document}
\tableofcontents
\section {A}
{\color{blue}Hello} World!
\begin{theorem}
\label{thm.1}
$$1=1\label{eq.1}$$
\end{theorem}
\begin{proof}
By reflexivity of $$=$$.
\end{proof}
Theorem \ref{thm.1} is about the equation \eqref{eq.1}.
\begin{bibdiv}
\begin{biblist}
\bib{MR1727844}{book}{
author={Bourbaki, Nicolas},
title={Algebra I. Chapters 1--3},
series={Elements of Mathematics (Berlin)},
note={Translated from the French;
Reprint of the 1989 English translation [ MR0979982 (90d:00002)]},
publisher={Springer-Verlag, Berlin},
date={1998},
pages={xxiv+709},
}
\end{biblist}
\end{bibdiv}
\end{document}

• The boxes around the TOC entries do not comply with the PDF/A-1b standard. You can turn the hyperlink-functionality of the TOC off by adding linktoc=none to the hyperref's package options. – DG' Feb 10 '15 at 11:28
• @DG' Yes, that works! However, I would like to keep the links in the TOC. I tried colorlinks=true, linkcolor=black. This removes the boxes, but does not produce a valid PDF/A-1b. Any idea how I can keep the links? – hal46 Feb 10 '15 at 11:39
• does the pdfx package help? – JPi Jun 9 '15 at 20:40
• pdfx does not help. I think that some solution based on patching of hyperref's link making code needed. For example in hpdftex.def and in hxetex.def there are following lines: \ifx\@urlbordercolor\relax \else /C[\@urlbordercolor]% \fi I think, one need to "remove" them by some patchcmd to get rid of "Annotation C" errors. By the way Word 2010 with it's option to save to pdf/A produces linkable text (links?) that (even colored) either is not annotated or is annotated the way that is causing errors. – Leonid Dec 20 '15 at 10:48
• @hal46 Hi! I'm failing to use pdfbox / preflight, it fails with most files. Could you add in a comment the command you are using to run it? – Keks Dose Jan 10 '18 at 15:33

With some dirty patchcmd (from etoolbox) of hyperref commands. Seems to work with pdflatex and lualatex. icc file from pdfx package.

\documentclass{article}
\pdfminorversion 4
\pdfcompresslevel=0
\immediate\pdfobj stream attr{/N 4} file{coated_FOGRA39L_argl.icc}
\pdfcatalog{%
/OutputIntents [ <<
/Type /OutputIntent
/S/GTS_PDFA1
/DestOutputProfile \the\pdflastobj\space 0 R
/OutputConditionIdentifier (Coated FOGRA39)
/Info(FOGRA39L)
>> ]
}
\usepackage[cmyk]{xcolor}
\usepackage{hyperxmp}
\usepackage[pdftex, pdfa]{hyperref}
\hypersetup{%
pdfauthor          = {a},
pdfkeywords        = {a, b, c},
pdflang            = {en},
pdftitle           = {a},
pdfsubject         = {a},
pdfcaptionwriter   = {a},
pdfcontactcity     = {a},
pdfcontactcountry  = {a},
pdfcontactemail    = {a},
pdfmetalang        = {en},
}

\makeatletter
% Dirty hack of hyperref to make rgb-like links annotated with C mark become annotated with K mark to work in PDF/A with CMYK
% makeatletter - makeatother needed
\usepackage{etoolbox}
\makeatother

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsrefs}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\begin{document}
\tableofcontents
\section {A}
{\color{blue}Hello} World!
\begin{theorem}
\label{thm.1}
$$1=1\label{eq.1}$$
\end{theorem}
\begin{proof}
By reflexivity of $$=$$.
\end{proof}
Theorem \ref{thm.1} is about the equation \eqref{eq.1}.
\begin{bibdiv}
\begin{biblist}
\bib{MR1727844}{book}{
author={Bourbaki, Nicolas},
title={Algebra I. Chapters 1--3},
series={Elements of Mathematics (Berlin)},
note={Translated from the French;
Reprint of the 1989 English translation [ MR0979982 (90d:00002)]},
publisher={Springer-Verlag, Berlin},
date={1998},
pages={xxiv+709},
}
\end{biblist}
\end{bibdiv}
\end{document}


It seems that the question, as originally asked, has been satisfactorily answered. But for the benefit of others who come here by search, let me add some clarifying information:

As a general rule, PDF/A (per the question) is for digital documents. Since the files will be viewed by computers, an RGB color profile is appropriate.

As a general rule, PDF/X is for printed documents. Since the color press almost certainly uses CMYK, a CMYK color profile is appropriate.

It is unlikely that a PDF/A file would use a CMYK profile, unless the same file is used both for digital viewing and print. In this case, when viewed on a computer, the CMYK colors are electronically converted back to RGB.

The most widely-used PDF/X technology requires only CMYK, not RGB. This dates back to a time when an industrial printing machine might not internally perform RGB to CMYK conversion. But for many years, such internal conversion is possible with industrial printers (and is routine for home and office printers). So, sometimes PDF/X with RGB color profile is accepted. The more advanced technologies allow you to mix-and-match different color profile within a single file.

A file can be both PDF/A and PDF/X, as long as the color profile(s) is (are) acceptable to all end users.

The OP linked to several free, online validators for PDF/A. I do not know of any for PDF/X.