Open DominikDostal opened 1 year ago
This is a side effect of the fact that pyHanko doesn't really look at page rotation settings. See these threads, for example:
You could try with NoRotate
, but given that that's notoriously finicky it might be better to hardwire the rotation into the annotation content stream after all... Somewhat ironically, this is what Acrobat actually does these days when putting signatures on rotated pages, instead of trying to use the format's "native" way of coping with these things.
I'll check how much effort this would be to implement.
Describe the bug When you create a signature on a page that has the Rotate Parameter (e.g.
/Rotate 90
) with the rotate_with_page paramter set to False then the visible Signature will correctly stay horizontal like it should when its opened in a browser.Should you then open the same file in Adobe Acrobat Reader instead, it will not be visible at all, but still have a clickable invisible box where it should have been visible, and a "selected" box that was rotated with the page.
To Reproduce Steps to reproduce the behavior: 1) Create any pdf (I used MS Word) 2) Rotate the PDF (I used https://smallpdf.com/rotate-pdf) 3) Sign the pdf with pyHanko:
Expected behavior Signature is visible in Adobe Acrobat reader.
Based on my research, which could very well be wrong, i think the Appearence Annotations need to have either the norotate flag set (if that is even possible) or
/Matrix
added to rotate it against the page rotation. Here are the values you would have to add as a/Matrix
parameter based on the/Rotate
parameter of the page:Screenshots When opened in Browser (Opera):
When opened in Adobe Acrobat Reader:
Environment (please complete the following information):
Here is the file that i used to create the screenshots:
faulty signature pyhanko.pdf