3

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:

enter image description here

But not in Adobe Reader:

enter image description here

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).

Scotty H
  • 5,646
  • 3
  • 27
  • 78

3 Answers3

6

This answer concentrates on the first question:

Why is this?

As I have no experience whatsoever with the Syncfusion PDF library, though, I cannot tell what you specifically

can do to fix this so that Adobe will recognize it.

The PDF object structure

Screenshot of Catalog contents

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 object 9 0.

Field object 9 0 also has a local name (also "Signature"; thus its fully qualified field name is Signature.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

Required if this field is the child of another in the field hierarchy

(ISO 32000-1, Table 220 – Entries common to all field dictionaries)

The single page of the document (object 5 0) in its Annots references references the field object 9 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 name Signature.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 name Signature.

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

to construct appearance streams and appearance dictionaries for all widget annotations in the document.

(ISO 32000-1, Table 218 – Entries in the interactive form dictionary)

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:

  • BS and MK are data for generating a standard appearance for the widget. Usually, though, visible signature bring their custom signature appearances along, and so does yours. So what are these values for?
  • DA, the default appearance string that shall be used in formatting the text of variable text annotations, e.g. FreeText annotations or text fields, but why a DA in a signature field?

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.

Community
  • 1
  • 1
mkl
  • 77,874
  • 12
  • 103
  • 212
  • Thank you for your detailed answer! Since produced the example with a blank PDF, I am wondering if there is something wrong with the Syncfusion library. I have passed on a link to your answer to the Syncfusion people via their forums. – Scotty H Aug 03 '17 at 03:24
  • @Scott please also send them the original, unsigned PDF so they can reproduce the issue. I still assume there is something special about it... – mkl Aug 03 '17 at 06:07
1

We have already faced this kind of issue in our side with the older version. Now we have fixed this issue in our latest version. Click here to download the latest version

Here is the sample to sign an existing PDF

Sowmiya
  • 76
  • 2
  • Welcome to SO Sowmiya. I am afraid what wd happen to your response if contents in mentioned links are changed or links are broken in future. It is better to include the essential parts of the answer here and provide the link for reference. – Nipun Aug 03 '17 at 11:39
  • @Sowmiya I am using Nuget package Syncfusion.AspNet.Mvc5 at version 14.1.0.46, which seems to be the current. Is this correct? – Scotty H Aug 03 '17 at 12:48
  • @ScottH The page Nipun linked talks about a version 15.2.0.40 released May 8th, 2017. – mkl Aug 03 '17 at 13:10
  • Here's the [Nuget package](https://www.nuget.org/packages/Syncfusion.AspNet.Mvc5/) I'm using, which I tested with Sowmiya's sample project, and that works as expected (thanks for providing a sample project). I switched out the PDF it was referencing (in the Data folder) for the one I used for this question (now available for download, see edit), and then it failed to produce a signature. I have edited my question to include the PDF before anything is done to it @mkl. – Scotty H Aug 03 '17 at 13:49
  • 1
    @ScottH I've had a look at the file. Its content is indeed trivial, merely its structure is somewhat convoluted (a linearized PDF with an incremental update, destroying linearity). I'm afraid I have no idea why Syncfusion behaves in such a weird manner with it. – mkl Aug 03 '17 at 16:01
  • @mkl Thanks for going the extra mile and confirming what is happening, as well as inspecting the PDF! – Scotty H Aug 03 '17 at 17:01
0

We have checked with the data file with sample. The problem is fixed in the latest version. Nuget Package you are using is considered to be the older version. Find the below link to download the latest nuget package.

Click here to download

Try the sample with the latest version.

Sowmiya
  • 76
  • 2