How to ignore page rotation while signing pdf using pyHanko? #150
-
hi, I'm trying to use pyHanko to add a visible signature to a PDF document. One of the documents has its page rotated by 90. I'm using the following code from the samples. I don't need background, just plain text.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Hi @ihegde, Per the PDF standard, the default behaviour of the Rotate entry in a page dictionary is to rotate all annotations along with the page content. That also applies to (visible) signature fields, and I'm pretty sure that's the cause of the behaviour you're seeing. The behaviour you want can be achieved by setting the In the meantime, you can work around the issue as follows:
Flag snippet:
(warning: untested code) Hope that helps. |
Beta Was this translation helpful? Give feedback.
Hi @ihegde,
Per the PDF standard, the default behaviour of the Rotate entry in a page dictionary is to rotate all annotations along with the page content. That also applies to (visible) signature fields, and I'm pretty sure that's the cause of the behaviour you're seeing.
The behaviour you want can be achieved by setting the
NoRotate
flag on the annotation, but unfortunately there's no convenient API to set that bit for you in pyHanko. It's not hard to add an option toSigFieldSpec
to toggle that one, though. I'll see what I can do about that and get back to you.In the meantime, you can work around the issue as follows:
pyhanko.sign.fields.append_signature…