Why does this PDF show a signature in Foxit Reader but not Adobe Reader?
Here is the code from the Syncfusion PDF library used to generate it (see also documentation about signing an existing document):
var signature = new PdfSignature(loadedDocument, page, certificate, "Signature");
signature.Certificate = certificate;
signature.Bounds = new RectangleF(100, 100, 200, 200);
signature.Appearence.Normal.Graphics.DrawRectangle(PdfBrushes.Red, new RectangleF(0, 0, 200, 200));
When I use this on an existing PDF a signature is identified in Foxit Reader:
But not in Adobe Reader:
Here is the resulting PDF for analysis.
Why is this? Is there anything I can do to fix this so that Adobe will recognize it?
EDIT
Here is the original PDF before anything is done to it.
SOLUTION
I used the Nuget package from Syncfusion's own Nuget server, which is up to date (the ones on Nuget.org are not).
This answer concentrates on the first question:
As I have no experience whatsoever with the Syncfusion PDF library, though, I cannot tell what you specifically
The PDF object structure
Broken field hierarchy
In the above screenshot one can see that in the AcroForm dictionary the Fields array has a single entry, field object
12 0
.Field object
12 0
only has a local name (value of T: "Signature") and a Kids array of descendant field objects containing a single descendant entry, field object9 0
.Field object
9 0
also has a local name (also "Signature"; thus its fully qualified field name isSignature.Signature
) and numerous other entries, most of them ok for a signature field and widget. It does not have a Parent entry.According to the PDF specification a Parent entry in a field is
The single page of the document (object
5 0
) in its Annots references references the field object9 0
in its role as a widget annotation.Thus, coming from the AcroForm dictionary Fields array, the field object
9 0
is a descendant of another field and has the fully qualified nameSignature.Signature
.But coming from the page via the Annots, the field object
9 0
does not have a parent and, therefore, appears as a root field with the fully qualified nameSignature
.Thus, the identity of the signature field is unclear.
Redraw requested
Furthermore one sees in the object structure above that in the AcroForm dictionary the NeedAppearances flag is set to
true
.This asks the PDF viewer
In the course of this Adobe Reader is known to remove annotations with broken structures. As explained above, the field structure of your signature field is broken.
Further peculiarities
Some of the entries of the signature field are somewhat peculiar:
What to do
Obviously the errors and peculiarities should be cleaned up. As mentioned above, I have no experience whatsoever with the Syncfusion PDF library, so I cannot tell you how to do that exactly.
One hint, though: I doubt that the Syncfusion PDF library regularly creates such nonsense when creating signatures, so there quite likely is something special about the document you want to sign, please check it. E.g. if the original document already contained a form field named "Signature", the broken structure might be a result of some Syncfusion code trying to merge a new signature field with the old field.