PDF/A 带有 CMYK,如何使用?

PDF/A 带有 CMYK,如何使用?

使用https://tex.stackexchange.com/a/99666https://tex.stackexchange.com/a/136653我认为我已经能够生成(使用 TeX Live 2014、pdfTeX 3.14159265-2.6-1.40.15)符合 PDF/A-1b 标准的 pdf,如下所示:

\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},
  pdfcontactaddress  = {a},
  pdfcontactcity     = {a},
  pdfcontactcountry  = {a},
  pdfcontactemail    = {a},
  pdfcopyright       = {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}

至少,PDFBox Preflight(http://en.wikipedia.org/wiki/Apache_PDFBox)说

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

还有 3-Heights PDF 验证器在线工具 (http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx)很高兴。

现在,我想使用 CMYK 颜色。所以我从下载了一个 icc 配置文件http://www.eci.org/en/downloads 并尝试了以下修改:

\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},
  pdfcontactaddress  = {a},
  pdfcontactcity     = {a},
  pdfcontactcountry  = {a},
  pdfcontactemail    = {a},
  pdfcopyright       = {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}

现在,PDFBox Preflight 抱怨:

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

3-Heights PDF Validator 在线工具表示:

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.

但是,如果我删除目录,似乎会生成有效的(根据 PDFBox Preflight)PDF/A-1b。

这是什么问题?如何解决?


更新:

问题似乎出在 hyperref 上。请参阅评论。是否可以重新定义 hyperref 的某些部分以避免出现问题?

我希望这样的事情能够发挥作用:

\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{%
  colorlinks = true,
    pdfauthor          = {a},
    pdfkeywords        = {a, b, c},
    pdflang            = {en},
    pdftitle           = {a},
    pdfsubject         = {a},
  pdfcaptionwriter   = {a},
  pdfcontactaddress  = {a},
  pdfcontactcity     = {a},
  pdfcontactcountry  = {a},
  pdfcontactemail    = {a},
  pdfcopyright       = {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}
\begin{equation}
1=1\label{eq.1}
\end{equation}
\end{theorem}
\begin{proof}
By reflexivity of \(=\).
\end{proof}
Theorem \ref{thm.1} is about the equation \eqref{eq.1}.
See also \cite{MR1727844}.
\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}

答案1

是否可以重新定义 hyperref 的某些部分以避免出现问题?

简短的回答:是的。

几年后,现在有了更简洁的方法来生成 CMYK PDF/A。CMYK 的一个优点是可以生成同时验证 PDF/A 和 PDF/X 的文档。

由于 PDF/X 5 之前禁止使用链接,这意味着您必须禁用它们。或者您让它们处于活动状态并“冒着”验证错误的风险。这已被视为标准中的一个问题,因此 PDF/X-6 草案正式允许使用超链接。

最小示例

%\pdfobjcompresslevel=0 %uncomment for Texlive
\documentclass{article}
\usepackage{lipsum}
\usepackage[pdfa,bookmarks=false]{hyperref} %bookmarks are incompatible with PDF/X<6
\usepackage[latin]{babel}
\usepackage{hyperxmp}[2020/06/15]
\usepackage{mmap} %only needed for pdfTeX, does not harm LuaTeX
\usepackage[cmyk,hyperref]{xcolor}

% Which paper did the authors have in mind when they created the document?
\immediate\pdfobj stream attr{/N 4} file{PSO_Uncoated_ISO12647_eci.icc}
\pdfcatalog{%
  /OutputIntents [ <<
    /Type /OutputIntent
    /S /GTS_PDFX
    /DestOutputProfile \the\pdflastobj\space 0 R
    /Info(PSO Uncoated ISO12647 (ECI))
    /OutputCondition(Offset printing, according to ISO 12647-2:2004/Amd1, OFCOM, paper type 4 = uncoated white, 115 g/m2, tone value increase curves C (CMY) and D (K))
    /OutputConditionIdentifier (Uncoated FOGRA47)
    /RegistryName(http://www.color.org)
  >>
  <<
    /Type /OutputIntent
    /S /GTS_PDFA1
    /DestOutputProfile \the\pdflastobj\space 0 R
    /Info(PSO Uncoated ISO12647 (ECI))
    /OutputCondition(Offset printing, according to ISO 12647-2:2004/Amd1, OFCOM, paper type 4 = uncoated white, 115 g/m2, tone value increase curves C (CMY) and D (K))
    /OutputConditionIdentifier (Uncoated FOGRA47)
    /RegistryName(http://www.color.org)
  >> ]
}

\makeatletter
% Bugfix of hyperref to produce CMYK links
\let\HyColor@HyperrefBorderColor\HyColor@XZeroOneThreeFour
\makeatother

\makeatletter
%we need to tell PDF/X the final format of the paper. This needs adjustment if you want graphics on the page border, called bleeding
\@tempdima=0.99626400996264009962\paperwidth
\edef\boxwd{\strip@pt\@tempdima}
\@tempdima=0.99626400996264009962\paperheight
\edef\boxht{\strip@pt\@tempdima}
\makeatother
\edef\next{%
  \protect\pdfpageattr{
    /TrimBox[0.0 0.0 \boxwd\space \boxht]
  }%
}
\next

\title{PDF/A-2b dummy document}
\author{anonymus}

\hypersetup{%
    pdfdisplaydoctitle=true,
    pdfversionid=1,
    pdftrapped=False,
    pdfapart=2,
    pdfaconformance=B,
    pdfstartpage={},
    pdfxstandard={PDF/X-4},
    urlbordercolor=red
}

\begin{document}
%\begin{NoHyper} %comment out to avoid links

\tableofcontents

\section {A}
\lipsum[1-2]
\url{http://tex.stackexchange.com/}

%\end{NoHyper} % comment out to avoid links
\end{document}

此示例使用较新的版本hyperxmp. 它在 Acrobat DC、VeraPDF 和3-高度在 pdfLaTeX 或 LuaLaTeX 中编译时。hyperref 解决方法是来自其问题追踪器

我使用 FOGRA47 作为颜色配置文件,因为它很小,因此很安全。您不会轻易冒着无法打印或无法在屏幕上显示的颜色的风险。该配置文件可从欧洲色彩倡议

答案2

使用一些脏的 patchcmd(来自etoolbox) 的hyperref命令。似乎与 pdflatex 和 lualatex 一起使用。icc 文件来自pdfx包裹。

\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{%
  colorlinks = true,
    pdfauthor          = {a},
    pdfkeywords        = {a, b, c},
    pdflang            = {en},
    pdftitle           = {a},
    pdfsubject         = {a},
  pdfcaptionwriter   = {a},
  pdfcontactaddress  = {a},
  pdfcontactcity     = {a},
  pdfcontactcountry  = {a},
  pdfcontactemail    = {a},
  pdfcopyright       = {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}
\patchcmd{\hyper@linkfile}{/C[}{/K[}{}{}
\patchcmd{\hyper@linkurl}{/C[}{/K[}{}{}
\patchcmd{\find@pdflink}{/C[}{/K[}{}{}
\patchcmd{\hyper@linkstart}{/C[}{/K[}{}{}
\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}
\begin{equation}
1=1\label{eq.1}
\end{equation}
\end{theorem}
\begin{proof}
By reflexivity of \(=\).
\end{proof}
Theorem \ref{thm.1} is about the equation \eqref{eq.1}.
See also \cite{MR1727844}.
\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}

答案3

看来,最初提出的问题已经得到令人满意的回答。但为了方便其他通过搜索来到这里的用户,让我补充一些澄清信息:

一般而言,PDF/A(根据问题)适用于数字文档。由于文件将通过计算机查看,因此 RGB 颜色配置文件是合适的。

一般而言,PDF/X 适用于印刷文档。由于彩色印刷机几乎肯定会使用 CMYK,因此 CMYK 颜色配置文件是合适的。

PDF/A 文件不太可能使用 CMYK 配置文件,除非同一个文件既用于数字查看又用于打印。在这种情况下,在计算机上查看时,CMYK 颜色会以电子方式转换回 RGB。

最广泛使用的 PDF/X 技术只需要 CMYK,不需要 RGB。这可以追溯到工业打印机可能无法在内部执行 RGB 到 CMYK 转换的时代。但多年来,这种内部转换在工业打印机上是可能的(对于家庭和办公室打印机来说也是常规做法)。因此,有时使用 RGB 颜色配置文件的 PDF/X 是可以接受的。更先进的技术允许您在单个文件中混合搭配不同的颜色配置文件。

只要颜色配置文件可被所有最终用户接受,文件就可以同时是 PDF/A 和 PDF/X。

OP 链接到了几个免费的 PDF/A 在线验证器。我不知道有任何适用于 PDF/X 的验证器。

相关内容