![使用 ConTeXt 生成 PDF/A](https://linux22.com/image/445504/%E4%BD%BF%E7%94%A8%20ConTeXt%20%E7%94%9F%E6%88%90%20PDF%2FA.png)
我正在尝试通过 ConTeXt 生成有效的 PDF/A,但 verapdf 验证器报告错误。
我的输入文档是
\setupinteraction
[title={TITLE},
author={AUTHOR}]
% attempt to generate PDF/A
\setupbackend
[format=pdf/a-3a,
profile={sRGB.icc},
intent=sRGB IEC61966-2.1]
\setupbackend[export=yes]
\setupstructure[state=start,method=auto]
\starttext
\input knuth
\stoptext
使用 进行编译context test.mkiv
和测试verapdf test.pdf
会导致以下验证错误:
<validationReport profileName="PDF/A-3A validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false">
<details passedRules="130" failedRules="1" passedChecks="1684" failedChecks="1">
<rule specification="ISO 19005-3:2012" clause="6.6.2.3" testNumber="7" status="failed" passedChecks="0" failedChecks="1">
<description>All properties specified in XMP form shall use either the predefined schemas defined in the XMP Specification,
ISO 19005-1 or this part of ISO 19005, or any extension schemas that comply with 6.6.2.3.2.</description>
<object>XMPProperty</object>
<test>(isPredefinedInXMP2005 == true || isDefinedInMainPackage == true || isDefinedInCurrentPackage == true) && isValueTypeCorrect == true</test>
<check status="failed">
<context>root/document[0]/metadata[0](15 0 obj PDMetadata)/XMPPackage[0]/Properties[2](http://purl.org/dc/elements/1.1/ - dc:description)</context>
<errorMessage>An XMP property is either not not pre-defined, is not defined in any extension schema, or has invalid type.</errorMessage>
</check>
</rule>
</details>
</validationReport>
有没有办法避免此验证错误?我尝试使用其他 PDF/A 风格,例如 pdf/a-1a:2005,但这没有任何改变。
答案1
这似乎是 ConTeXt 提供的元数据模式的问题;正在制定适当的修复方案讨论在邮件列表中。
目前,PDF 仍然可以通过删除该dc:description
字段来使其符合 PDF/A-3A 标准,例如使用pikepdf
图书馆。
import pikepdf
import sys
infile = sys.argv[1]
outfile = sys.argv[2]
with pikepdf.open(infile) as pdf:
with pdf.open_metadata() as meta:
del meta['dc:description']
pdf.save(outfile)
使用脚本作为python3 fix.py input.pdf output.pdf
。