You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
input_file='input path here'output_file='output path here'signer=signers.SimpleSigner.load(certificate_key, certificate_cert)
inFile=open(input_file, 'rb')
w=IncrementalPdfFileWriter(inFile, strict=False)
fields.append_signature_field(
w, sig_field_spec=fields.SigFieldSpec(
'Signature',
box=(31, 195, 564, 99),
on_page=0,
visible_sig_settings=fields.VisibleSigSettings(False)
)
)
meta=signers.PdfSignatureMetadata(field_name='Signature')
stamp_style=stamp.StaticStampStyle.from_pdf_file(stamp_file,
border_width=0,
background_layout=SimpleBoxLayoutRule(
margins=Margins(0,0,0,0),
x_align=AxisAlignment.ALIGN_MID,
y_align=AxisAlignment.ALIGN_MID,
inner_content_scaling=InnerScaling.STRETCH_FILL
),
)
pdf_signer=signers.PdfSigner(
# stamp style: https://pyhanko.readthedocs.io/en/latest/api-docs/pyhanko.html#pyhanko.stamp.StaticStampStylemeta, signer=signer, stamp_style=stamp_style
)
withopen(output_file, 'wb') asoutFile:
# with QR stamps, the 'url' text parameter is special-cased and mandatory, even if it# doesn't occur in the stamp text: this is because the value of the 'url' parameter is# also used to render the QR code.pdf_signer.sign_pdf(
w, output=outFile,
)
inFile.close()
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:
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:
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
The text was updated successfully, but these errors were encountered: