1

I'm using this library https://github.com/vbuch/node-signpdf to sign a pdf document. After I have signed the document I can see the signature when I open the pdf with Foxit reader but not when I open it with Adobe reader DC. I also tried Adobe reader XI but there I can't see it either. When I open the document in pdf xchange viewer I get this error: non critical errors detected in the xref table.

Any ideas what the problem could be?

That's the file I signed: https://drive.google.com/file/d/1AZvS4sP2Y3FwW4Deod87Dgxc9I0QZkoc/view?usp=sharing

  • Please share your signed PDF for analysis. – mkl Nov 02 '20 at 17:19
  • How can I attach a file to my question? –  Nov 02 '20 at 17:52
  • Stack overflow does not provide means for attaching files. Thus, people usually use file sharing services (e.g. public shares on google drive or drop box; please don't use a service that puts many ads in the way of downloading the file) to host the file and share the access URL here. – mkl Nov 02 '20 at 19:08
  • @mkl thank you for the explanation. I added the file to the question. –  Nov 03 '20 at 07:43

1 Answers1

1

In your example PDF the name of the signature field consists of 10 bytes, 9 bytes with value 0x00 and one byte with value 0x01. Apparently Adobe Reader does not like that field name.

After some experiments it looks like Adobe Reader does not like a field name starting with a 0x00 byte.

Maybe it contains some code that determines string lengths in a c'ish manner and interprets a 0x00 as end-of-string. A field name with a leading 0x00 byte, therefore, is interpreted as empty string, a field name not accepted by Adobe Reader either.

Thus, please use a signature field name made of (in particular starting with) some meaningful characters. As validators usually display the name of the signature field, this is a good idea anyways.


In terms of lowlevel PDF objects:

The signature field object looks like this:

18 0 obj
<<
/Type /Annot
/Subtype /Widget
/FT /Sig
/Rect [0 0 0 0]
/V 17 0 R
/T (         )
/F 4
/P 1 0 R
>>
endobj 

but only like this, the string value of the T entry actually contains the above mentioned nine 0x00 bytes and one 0x01 byte. This is the value that must be changed to a non-empty string not starting with 0x00. I would propose not using bytes < 0x20 at all. Furthermore, the dot, 0x2e, must not be used in the name, it is reserved for separating partial names.

mkl
  • 90,588
  • 15
  • 125
  • 265
  • Where can I see the name of the signature field? –  Nov 03 '20 at 13:20
  • I opened the pdf in an editor but all I see is this: /Name (����������) –  Nov 03 '20 at 16:05
  • The name of the signature field is the value of the **T** entry in the signature field object, but that entry should look similar in your editor. Unfortunately my JavaScript knowledge does not suffice to clearly point at some code which is at fault here. – mkl Nov 03 '20 at 16:49
  • Nice! I changed the first number of the T entry from 00 to 01 and now the signature is visible. Thank you very much mkl! Maybe you could add the tip with the T field to your answer? –  Nov 03 '20 at 17:31