9

So I am trying to validate my document as PDF/A, and I'm almost there. The last remaining problem concerns graphics generated by TikZ. Consider this MWE:

% !TeX program  = lualatex

\documentclass{article}
\usepackage{fontspec}

\usepackage{tikz}
\usepackage{hyperxmp}
\usepackage[pdfa]{hyperref}   

   \immediate\pdfobj stream attr{/N 3}  file{eciRGB_v2.icc}
   \pdfcatalog{%
       /OutputIntents [ <<
           /Type /OutputIntent
           /S/GTS_PDFA1
           /DestOutputProfile \the\pdflastobj\space 0 R
           /OutputConditionIdentifier (eciRGB v2)
           /Info(eciRGB v2)
       >> ]
   }

\hypersetup{pdftitle={Foobar},pdfaconformance={U},pdfapart={2}}                               

\pdfvariable suppressoptionalinfo 15
\pdfvariable omitcidset=1

\begin{document}

\def\firstcircle{(0,0) circle (4cm)}
\def\secondcircle{(360:4.5cm) circle (4cm)}
{
\begin{figure}[ht!]
 \centering
 \begin{tikzpicture}[blend group=screen,scale=.667]
  \begin{scope}[fill opacity=0.3,text opacity=1,black,line width=.75pt,
align=center,text width=4cm]
    \draw[fill=blue!60!cyan!60!black] \firstcircle 
    node[align=right,shift={(-1.85,0)},text=blue!50!cyan!60!black]{Foo};
    \draw[fill=violet!60!red] \secondcircle 
    node[align=left,shift={(1.85,0)},text=violet!60!red]{Bar};
    \node[text=black] at (2.15,0){\Large\textbf{Foobar}};
  \end{scope}
\end{tikzpicture} 
 \caption{Source: Some Foobar or Other.}
\end{figure}

\end{document}

(Color profile can be found here.)

enter image description here

When I try to validate the resulting .pdf, I get the following error message:

Specification: ISO 19005-2:2011, Clause: 6.2.10, Test number: 1
Only blend modes that are specified in ISO 32000-1:2008 shall be used for the value of the BM key in an extended graphic state dictionary. Failed 1 occurrences
PDExtGState
BM == null || BM == "Normal" || BM == "Compatible" || BM == "Multiply" || BM == "Screen" || BM == "Overlay" || BM == "Darken" || BM == "Lighten" || BM == "ColorDodge" || BM == "ColorBurn" || BM == "HardLight" || BM == "SoftLight" || BM == "Difference" || BM == "Exclusion" || BM == "Hue" || BM == "Saturation" || BM == "Color" || BM == "Luminosity"

How can I make TikZ play nicely with PDF/A?

2
  • do you use the eciRGB_v2.icc profile for a specific reason? Jul 31 at 14:14
  • No. I have before, and it seemed to work. Is there any reason I should not? Any others would probably work just as well for me.
    – Ingmar
    Jul 31 at 14:15
12

pgf stores the blend mode in an array, that is allowed (but deprecated in pdf 2.0) but the validator seems not to like it. You can patch the command to use only a name:

\usepackage{etoolbox}
\makeatletter
\patchcmd\pgfsys@blend@mode{[ /\pgf@temp ]}{/\pgf@temp}{}{\fail}
\makeatletter

(I opened an issue for this https://github.com/pgf-tikz/pgf/issues/1037)

With a current LaTeX you can set the standard also like this, (it will use sRGB.icc as color profile):

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{
  %uncompress,
  pdfstandard=A-2U,
  }

\documentclass{article}
\usepackage{fontspec}

\usepackage{tikz}
\usepackage{hyperxmp}
\usepackage{hyperref}

\usepackage{etoolbox}
\makeatletter
\patchcmd\pgfsys@blend@mode{[ /\pgf@temp ]}{/\pgf@temp}{}{\fail}
\makeatletter

\hypersetup{pdftitle={Foobar}}

\pdfvariable omitcidset=1

\begin{document}

\def\firstcircle{(0,0) circle (4cm)}
\def\secondcircle{(360:4.5cm) circle (4cm)}

\begin{figure}[ht!]
 \centering
 \begin{tikzpicture}[blend group=screen,scale=.667]
  \begin{scope}[fill opacity=0.3,text opacity=1,black,line width=.75pt,
align=center,text width=4cm]
    \draw[fill=blue!60!cyan!60!black] \firstcircle
    node[align=right,shift={(-1.85,0)},text=blue!50!cyan!60!black]{Foo};
    \draw[fill=violet!60!red] \secondcircle
    node[align=left,shift={(1.85,0)},text=violet!60!red]{Bar};
    \node[text=black] at (2.15,0){\Large\textbf{Foobar}};
  \end{scope}
\end{tikzpicture}
 \caption{Source: Some Foobar or Other.}
\end{figure}

\end{document}
2
  • 3
    Thank you for this most excellent answer, including the nod to the pdfmanagement-testphase package. Works like a charm.
    – Ingmar
    Jul 31 at 14:44
  • Just a quick update: VeraPDF and most online validators have no issues, but at least one validator (bfo.com/blog/2017/11/08/verify_pdfa_online) complains that XMPMetaDataIsFiltered is set, but shouldn't be, whatever that means exactly. I am happy as is, just wanted to drop a quick note here.
    – Ingmar
    Aug 1 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.