I have a pdf/a compliant file (I use acrobat to do preflight check and it does not find any problems). I then sign the file with itextsharp, using pdfAStamper. There are two possible outcomes of the signing process in itext regarding pdfa compliance.
If the signature is not visible, the pdf stays pdfa compliant:
stamper = PdfAStamper.CreateSignature(reader, os, '\0'); PdfSignatureAppearance appearance = stamper.SignatureAppearance; appearance.Reason = cerReason; appearance.Location = cerLocation; IExternalSignature pks = new PrivateKeySignature(pk, digestAlgorithm); MakeSignature.SignDetached(appearance, pks, chain, crlList, ocspClient, tsaClient, estimatedSize, subfilter);
If I add a visible signature as in Bruno Lowagie's paper, ch 2.4.2, then the preflight check reports: CIDset in subset font is incomplete
The error is reported on the font that has been added by:
BaseFont bfA = BaseFont.CreateFont(fntPath, BaseFont.IDENTITY_H, true);
the full code looks like
stamper = PdfAStamper.CreateSignature(reader, os, '\0');
PdfSignatureAppearance appearance = stamper.SignatureAppearance;
appearance.Reason = cerReason;
appearance.Location = cerLocation;
BaseFont bfA = BaseFont.CreateFont(fntPath, BaseFont.IDENTITY_H, true);
appearance.SetVisibleSignature(new Rectangle(50, 100, 400, 200), nP, "Signature");
appearance.Layer2Font = new Font(bfA, 12);
appearance.Layer2Text = cerL2Text + DateTime.Now;
appearance.SignatureRenderingMode = PdfSignatureAppearance.RenderingMode.GRAPHIC_AND_DESCRIPTION;
appearance.SignatureGraphic = Image.GetInstance(staPath);
IExternalSignature pks = new PrivateKeySignature(pk, digestAlgorithm);
MakeSignature.SignDetached(appearance, pks, chain, crlList, ocspClient, tsaClient, estimatedSize, subfilter);
The ultimate question is how to make the latter example produce pdfa compliant file, ie. how to ger rid of the CIDset in subset font is incomplete error?