I have a pdf / a compliant file (I use acrobat to check the pre-flight check and it does not detect any problems). Then I sign the file using itextsharp using pdfAStamper. There are two possible outcomes of the itext signing process regarding pdfa compliance.
If the signature is not visible, the PDF file supports pdfa:
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 the paper of Bruno Loughay, ch 2.4.2, then the preflight check reports: CIDset in the font of the subset is incomplete.
An error is reported about the font that has been added:
BaseFont bfA = BaseFont.CreateFont(fntPath, BaseFont.IDENTITY_H, true);
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 final question is how to get the last example to create a pdfa compatible file, i.e. how to get rid of cidset in a font subset is an incomplete error?