我尝试使用下面的参数:
'-dPDFA=2 ' +
'-dBATCH ' +
'-DNOSAFER ' +
'-dNOPAUSE ' +
'-sColorConversionStrategy=UseDeviceIndependentColor ' +
'-sDEVICE=pdfwrite ' +
'-dPDFACompatibilityPolicy=1 ' +
'-o ./temp.pdf' +
'./PDFA_def.ps' +
'./out/temp.pdf'我的PDFA_def.ps看起来是这样的:
%!
% This is a sample prefix file for creating a PDF/A document.
% Users should modify entries marked with "Customize".
% This assumes an ICC profile resides in the file (srgb.icc),
% in the current directory unless the user modifies the corresponding line below.
% Define entries in the document Info dictionary :
% Define an ICC profile :
/ICCProfile (/Users/user/nestjs/ISOcoated_v2_300_eci.icc) % Customise
def
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
%% This code attempts to set the /N (number of components) key for the ICC colour space.
%% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
%% ColorConversionStrategy is not set.
%% This is not 100% reliable. A better solution is for the user to edit this and replace
%% the code between the ---8<--- lines with a simple declaration like:
%% /N 3
%% where the value of N is the number of components from the profile defined in /ICCProfile above.
%%
[{icc_PDFA}
<<
>> /PUT pdfmark
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
% Define the output intent dictionary :
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
/Type /OutputIntent % Must be so (the standard requires).
/S /GTS_PDFA1 % Must be so (the standard requires).
/DestOutputProfile {icc_PDFA} % Must be so (see above).
/OutputConditionIdentifier (ISO Coated v2 300% (ECI)) % Customize
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark我在寻找解决方案时下载的ISOcoated_v2_300_eci.icc。我尝试使用来自gs/lib/iccprofile/的默认iccs /我尝试使用-sColorConversionStrategy RGB、CMYK、Gray而不是UseDeviceIndependentColor --它没有帮助。对话成功结束,Ghostscript不会抛出任何错误。但是,当我在veraPDF中验证结果文件时,我得到了下面的报告 (html文件)。
你对我有什么想法吗?
更新
发布于 2019-11-12 08:27:26
一个直接的问题是,您已经将Ghostscript设置为生成一个PDF/A2文件,并且您正在测试是否符合PDF/A-1,这是一个更早、更严格的标准。您需要为PDF/A-2设置PDFA=1或测试一致性
如果使用DeviceIndependentColor,则不需要指定OutputIntent。如果使用RGB、CMYK或Gray,则必须使用具有适当数量的组件的OutptuIntent。我怀疑你在这条路上搞错了。
您没有提供输入文件或输出文件,因此不可能对HTML文件中的许多错误报告进行注释,而且html文件中的链接也无法遵循。我建议您提供源文件和输出文件,以及这些特定文件的一致性报告。
编辑
使用上面的原始文件和srgb.icc配置文件(您不能使用Ghostscript概要文件,因为它们是版本4的概要文件,并且与PDF/A-1不兼容)和-sColorConversionStrategy=RGB I一起生成了这 PFD/A-1b文件。使用VeraPDF的当前版本,使用PDF/A-1b一致性测试进行无投诉验证。
另一个编辑
使用当前代码和此命令行:
gs -dNOSAFER -sDEVICE=pdfwrite -dPDFA=2 -sColorConversionStrategy=RGB -dPDFACompatibilityPolicy=1 -sOutputFile=pdfa2.pdf pdfa_def.ps "vertrag.pdf"其中,vertrag.pdf是原始输入文件,pdfa_def.ps包含:
%!
% This is a sample prefix file for creating a PDF/A document.
% Users should modify entries marked with "Customize".
% This assumes an ICC profile resides in the file (srgb.icc),
% in the current directory unless the user modifies the corresponding line below.
% Define entries in the document Info dictionary :
[ /Title (Title) % Customise
/DOCINFO pdfmark
% Define an ICC profile :
/ICCProfile (/temp/srgb.icc) % Customise
def
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
%% This code attempts to set the /N (number of components) key for the ICC colour space.
%% To do this it checks the ColorConversionStrategy or the device ProcessColorModel if
%% ColorConversionStrategy is not set.
%% This is not 100% reliable. A better solution is for the user to edit this and replace
%% the code between the ---8<--- lines with a simple declaration like:
%% /N 3
%% where the value of N is the number of components from the profile defined in /ICCProfile above.
%%
[{icc_PDFA}
<<
%% ----------8<--------------8<-------------8<--------------8<----------
systemdict /ColorConversionStrategy known {
systemdict /ColorConversionStrategy get cvn dup /Gray eq {
pop /N 1 false
}{
dup /RGB eq {
pop /N 3 false
}{
/CMYK eq {
/N 4 false
}{
(ColorConversionStrategy not a device space, falling back to ProcessColorModel, output may not be valid PDF/A.)=
true
} ifelse
} ifelse
} ifelse
} {
(ColorConversionStrategy not set, falling back to ProcessColorModel, output may not be valid PDF/A.)=
true
} ifelse
{
currentpagedevice /ProcessColorModel get
dup /DeviceGray eq {
pop /N 1
}{
dup /DeviceRGB eq {
pop /N 3
}{
dup /DeviceCMYK eq {
pop /N 4
} {
(ProcessColorModel not a device space.)=
/ProcessColorModel cvx /rangecheck signalerror
} ifelse
} ifelse
} ifelse
} if
%% ----------8<--------------8<-------------8<--------------8<----------
>> /PUT pdfmark
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
% Define the output intent dictionary :
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
/Type /OutputIntent % Must be so (the standard requires).
/S /GTS_PDFA1 % Must be so (the standard requires).
/DestOutputProfile {icc_PDFA} % Must be so (see above).
/OutputConditionIdentifier (sRGB) % Customize
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark(这是Ghostscript 9.50提供的使用srgb配置文件的示例)
我得到了这文件。执行VeraPDF的PDF/A-2b配置文件(版本1.14.8 Greenfield解析器)提供绿色文本"PDF符合验证配置文件的要求“
我注意到您已经在您的pdfa_def.ps版本中删除了剪刀行,但是您已经按照说明所示,添加了一个类似于/N 3的行,而不是。这个值必须是正确的,它必须是ICC配置文件中组件的数量,这就是为什么您必须自己添加它。或者,当然,只需将试图为您做这件事的行放在适当的位置。如果您删除它们,则由您来用正确的值替换它们。
请注意,Ghostscript将发出多个警告,因为原始文件包含设置为1的重印模式,这在PDF/A-2中是不允许的,它有一个在PDF/A-2中不允许的非打印注释,而文档信息中的字符串是UTF16BE,这在PDF/A-2 (或A-1)中也是不允许的。由于您选择的PDFACompatibilityPolicy,这些都将被删除,这可能会导致生成的PDF文件呈现错误。
作为另一个实验,我使用了以下命令行:
gs -dNOSAFER -sDEVICE=pdfwrite -dPDFA=2 -sColorConversionStrategy=UseDeviceIndependentColor -dPDFACompatibilityPolicy=1 -sOutputFile=pdfa2.pdf "vertrag.pdf"因为它使用DeviceIndependentColor,所以不需要执行pdfa_def.ps (我们不需要PDF文件中的OutputIntent ),而且该文件还可以使用相同版本的VeraPDF验证是否兼容。
对于额外的健全检查,我使用Acrobat飞行前工具来检查文件,这也验证了它们是兼容的。
https://stackoverflow.com/questions/58813905
复制相似问题