Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature invisible in Adobe Reader but visible in other viewers #416

Open
rfabbri opened this issue Mar 30, 2024 · 7 comments
Open

Signature invisible in Adobe Reader but visible in other viewers #416

rfabbri opened this issue Mar 30, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@rfabbri
Copy link

rfabbri commented Mar 30, 2024

Describe the bug
When I create a visible signature, I can see it in Preview and Skim, but not o Adobe Reader.
The visible signature display should be about halfway down, centralized in the page.

To Reproduce

pyhanko sign addsig  --field 1/500,530,100,485/Signature1 pkcs12 in.pdf out.pdf cert.pfx

Open in Skim and Preview, the signature is visible, but Acrobat Reader does not display it.

Expected behavior
I expect all PDF viewers to display the visible part of the signature.
The pyhanko signature validates digitally, but it might pose bureaucratic impediments if the officer cannot see any visual mark.

Environment (please complete the following information):

  • OS: Mac OS 12.6.6 Monterey
  • Adobe Reader 2024.001.20615
@MatthiasValvekens
Copy link
Owner

Hi, this kind of problem is unfortunately impossible to diagnose without a copy of the specific input document that's giving you issues. Can you provide one?

I'm also assuming that the actual configuration you're using to populate the visible field is somewhere in your configuration file, can you share that as well?

@Salamek
Copy link

Salamek commented Apr 8, 2024

I have encountered this behavior when AcroForm ->NeedAppearances is present and set to 'true', when document is not signed PDF acrobat reader displays signature field ok, but when i sign it using pyhanko, NeedAppereances is copied over with signature to this block:

<ORIGINAL_PDF>
%%EOF
2 0 obj
<<
/Producer (WeasyPrint 61\0562\073 pyHanko 0\05623\0561)
/ModDate (D\07220240408220437\05302\04700\047)
>>
endobj
3 0 obj
<<
/Type /Catalog
/Pages 1 0 R
/AcroForm <<
/Fields [ 7 0 R ]
/DR 4 0 R
/NeedAppearances true
/SigFlags 3
>>
<REST_OF_SIGNATURE>

And signature field become invisible, it also disappear from list of signatures... (So PDF in PDF acrobat reader looks like unsigned)

All other PDF readers are fine, just PDF acrobat reader is doing this..., when i remove NeedAppearances or set it to false in unsigned PDF and sign it using pyhanko all is well in PDF acrobat reader...

From my testing it looks like /NeedAppearances true carried over to signature block is the issue?

I'm also attaching my testing PDFs:

  • signed-61.2-need-app-false.pdf: Signed PDF where NeedAppearances was set to 'false' before signing (Work ok in PDF acrobat reader)
  • signed-61.2-need-app-removed.pdf: Signed PDF where NeedAppearances was removed before signing (Work ok in PDF acrobat reader)
  • signed-61.2-uncompressed.pdf: Signed PDF where NeedAppearances was set to 'true' (default behavior of my PDF * generator) this is broken in PDF acrobat reader
  • unsigned-61.2-uncompressed.pdf: Unsigned PDF where NeedAppearances was set to 'true' (default behavior of my PDF generator) this is displayed correctly in PDF acrobat reader
  • unsigned-54.2.pdf: Unsigned PDF where NeedAppearances is missing (Work ok in PDF acrobat reader)
  • signed-54.2.pdf: Signed PDF where NeedAppearances is missing (Work ok in PDF acrobat reader)
  • signed-61.2-uncompressed-app-removed-from-sig.pdf: Signed PDF where NeedAppearances was manually removed from signature block, signature is displayed correctly in PDF acrobat reader but PDF is corrupted (i did simple delete in text editor)

signed-61.2-need-app-false.pdf
signed-61.2-need-app-removed.pdf
signed-61.2-uncompressed.pdf
unsigned-61.2-uncompressed.pdf
unsigned-54.2.pdf
signed-54.2.pdf
signed-61.2-uncompressed-app-removed-from-sig.pdf

54.2 means PDF generated using Weasyprint 54.2
61.2 means PDF generated using Weasyprint 61.2
(I was dissecting missing signatures in PDF acrobat reader after weasyprint update)

@MatthiasValvekens
Copy link
Owner

Huh, interesting. If NeedAppearances is the culprit, that kind of tracks. It's deprecated in PDF 2.0 and probably ignored by all non-Acrobat processors anyhow. The PDF 2.0 requirement is that all fields need to supply appearance streams, so NeedAppearances is pretty much obsolete.

Nonetheless, I would assume that NeedAppearances only kicks in on fields that don't already have an appearance stream... The fact that that's not what you observe is indeed strange.

If systematically removing NeedAppearances solves the problem, I'm happy to do that (or perhaps hiding it behind a toggle). I don't really have the energy to hunt down all the quirks of Acrobat these days :)

@Salamek
Copy link

Salamek commented Apr 9, 2024

Hmm i'm going to check if AP is set for signature field...

@Salamek
Copy link

Salamek commented Apr 9, 2024

Ok affected field does have AP specified...

@Salamek
Copy link

Salamek commented Apr 12, 2024

@MatthiasValvekens i think that not passing NeedAppearances to signature block after EOF as a option should do the trick (not sure what should be the default behavior tho, up to you)

@MatthiasValvekens
Copy link
Owner

Thanks for that analysis. I think removing NeedAppearances by default is probably a sane thing to do. I plan to cut a release later this month, this can probably be squeezed in.

@MatthiasValvekens MatthiasValvekens added the enhancement New feature or request label Apr 15, 2024
@MatthiasValvekens MatthiasValvekens self-assigned this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants