Replies: 2 comments 4 replies
-
Yeah, that's because the interaction between page rotation settings and annotations is a bit wonky in PDF. It's notoriously hard to write code that magically does the right thing in all cases (side note: I personally believe that adding a separate page rotation control to the file format outside of the standard graphics model was a design mistake in hindsight, but that ship has long sailed). IIRC Acrobat even just compensates for page rotation in the signature appearance stream directly (by prepending it with the inverse rotation transformation). pyHanko could perhaps do the same thing by default, but it's something for which I would need to find time to investigate. I'd welcome a PR adding such functionality, though. Just to make sure: did you try experimenting with the |
Beta Was this translation helpful? Give feedback.
-
Hi, @crodbor and @MatthiasValvekens I have the same problem as @crodbor and I identified the same behavior in some PDF in landscape orientation. For now, while pyHanko doesn't support it, I was trying to rotate the content, doing what @crodbor have shown above. I also use To make the test, I rotated a PDF 90 degrees clockwise in After signing the document, the Is the Thanks a lot. |
Beta Was this translation helpful? Give feedback.
-
I've had to add a signature field to some PDF in landscape orientation, so I used the standard approach with the
append_signature_field
function. It worked but for some reason the origin of coordinates was at the top left, which is not a serious problem.However, after the field was signed the text inside was rotated. After some test with other PDF in the same orientation I arrived to the conclusion that the ones I wanted to add the field behaved as in portrait orientation and then rotated, which I assume is due to the program that generates them.
In order to let the signature be afterwards in the correct orientation I had to patch the
__init__
method of theSignatureFormField
class like this:The problem with this approach is that the behavior is still fixed and not customizable for different cases.
It would be interesting to add the option of rotation to the API, maybe in the
VisibleSigSettings
class.Beta Was this translation helpful? Give feedback.
All reactions