使用 IText 与 VisualRepresentation 签名后,PDF-A1a 文档无效
PDF-A1a document not valid after signing with VisualRepresentation using IText
我使用 IText 7.15.0 对 PDF-A1a 文档进行数字签名。
除了数字签名之外,我还在文档中添加了视觉表示(图像)。
PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
appearance.SetPageNumber(1);
Rectangle pr = new Rectangle(10 + ImageOffset, 10 + ImageOffset, 100, 100 );
appearance.SetPageRect(pr);
byte[] image = System.IO.File.ReadAllBytes(VisualAppearance);
appearance.SetRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC);
ImageData imageData = ImageDataFactory.Create(image);
appearance.SetSignatureGraphic(imageData);
此代码有效且签名有效。
但如果文档是 PDF-A1a,则它不再是有效的 PDF-A1a。只有当我添加视觉表示时它才会变得无效。如果我只是在没有视觉表示的情况下应用签名,它仍然是有效的 PDF-A1a。
其他 PDF-A 标准(如 A2a)在添加视觉表示时仍然有效。
使用foxit phantom验证PDF-A1a时,出现如下信息:
A transparent soft mask is present. Beginning with PDF 1.4 transparency is supported. Some PDF-based ISO standards prohibit the use of transparency.
我需要做什么才能在添加视觉表示时保持 PDF-A1a 有效?
正如 Foxit 已经告知的那样,一些标准禁止在合规文件中使用透明度,特别是 ISO 19005-1 对 PDF/A-1 配置文件做了一些规定,其中包括:
If an SMask key appears in an ExtGState or XObject dictionary, its value shall be None.
(ISO 19005-1,第 6.4 节透明度)
但是如果 iText 将带有透明度信息的图像添加到 PDF,它会将透明度信息转换为结果图像的非消失 SMASK 条目 XObject .
为防止这种情况,只需使用不透明的图像即可。
在你确认
If i use jpeg instead of png, the PDF-A1a remains valid.
对于非矩形图像轮廓,请考虑使用剪辑路径。
我使用 IText 7.15.0 对 PDF-A1a 文档进行数字签名。
除了数字签名之外,我还在文档中添加了视觉表示(图像)。
PdfSignatureAppearance appearance = signer.GetSignatureAppearance();
appearance.SetPageNumber(1);
Rectangle pr = new Rectangle(10 + ImageOffset, 10 + ImageOffset, 100, 100 );
appearance.SetPageRect(pr);
byte[] image = System.IO.File.ReadAllBytes(VisualAppearance);
appearance.SetRenderingMode(PdfSignatureAppearance.RenderingMode.GRAPHIC);
ImageData imageData = ImageDataFactory.Create(image);
appearance.SetSignatureGraphic(imageData);
此代码有效且签名有效。 但如果文档是 PDF-A1a,则它不再是有效的 PDF-A1a。只有当我添加视觉表示时它才会变得无效。如果我只是在没有视觉表示的情况下应用签名,它仍然是有效的 PDF-A1a。
其他 PDF-A 标准(如 A2a)在添加视觉表示时仍然有效。
使用foxit phantom验证PDF-A1a时,出现如下信息:
A transparent soft mask is present. Beginning with PDF 1.4 transparency is supported. Some PDF-based ISO standards prohibit the use of transparency.
我需要做什么才能在添加视觉表示时保持 PDF-A1a 有效?
正如 Foxit 已经告知的那样,一些标准禁止在合规文件中使用透明度,特别是 ISO 19005-1 对 PDF/A-1 配置文件做了一些规定,其中包括:
If an SMask key appears in an ExtGState or XObject dictionary, its value shall be None.
(ISO 19005-1,第 6.4 节透明度)
但是如果 iText 将带有透明度信息的图像添加到 PDF,它会将透明度信息转换为结果图像的非消失 SMASK 条目 XObject .
为防止这种情况,只需使用不透明的图像即可。
在
If i use jpeg instead of png, the PDF-A1a remains valid.
对于非矩形图像轮廓,请考虑使用剪辑路径。