因此,我尝试将我的文档验证为 PDF/A,并且我快完成了。最后一个问题涉及由 生成的图形TikZ
。考虑这个 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}
(颜色配置文件可以找到这里。
当我尝试验证生成的 .pdf 时,收到以下错误消息:
规范:ISO 19005-2:2011,条款:6.2.10,测试编号:1
仅应将 ISO 32000-1:2008 中指定的混合模式用于扩展图形状态字典中 BM 键的值。失败 1 次
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 ==“光度”
我怎样才能TikZ
与 PDF/A 顺利配合?
答案1
pgf 将混合模式存储在数组中,这是允许的(但在 pdf 2.0 中已弃用),但验证器似乎不喜欢它。您可以修补命令以仅使用名称:
\usepackage{etoolbox}
\makeatletter
\patchcmd\pgfsys@blend@mode{[ /\pgf@temp ]}{/\pgf@temp}{}{\fail}
\makeatletter
(我为此开了一个问题https://github.com/pgf-tikz/pgf/issues/1037)
使用当前的 LaTeX 您也可以像这样设置标准(它将使用 sRGB.icc 作为颜色配置文件):
\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}