MatthiasValvekens / pyHanko

pyHanko: sign and stamp PDF files
MIT License
483 stars 71 forks source link

The Coordinates Not Set Properly #334

Closed farasjibran closed 9 months ago

farasjibran commented 10 months ago

Describe the bug I have problems when I want to sign using this library. When I try to sign with a PDF file that has a PDF version below 1.7, the signature I put does not match the location or coordinates I have provided.

To Reproduce this my code to sign

fields.append_signature_field( w, sig_field_spec=fields.SigFieldSpec( f'InternalSignature{order}', box=(int(x1), int(y1), int(x2), int(y2)), on_page=(newPageNumber) ), )

Expected behavior My expectation is that I can sign with PDF files that have a PDF version below 1.7

Screenshots

This my pdf and the version of the pdf and this works :

image image

This my pdf and the version of the pdf and this not works properly :

image image

Environment (please complete the following information):

MatthiasValvekens commented 10 months ago

Is the bottom PDF rotated? If so, that's a known issue. See #266 for some pending work to fix it.

farasjibran commented 10 months ago

Is the bottom PDF rotated? If so, that's a known issue. See #266 for some pending work to fix it.

the bottom pdf is not rotated but i think the resolution is the one of the problem

MatthiasValvekens commented 10 months ago

the bottom pdf is not rotated but i think the resolution is the one of the problem

Well, if your page is smaller, then obviously the coordinates of your box are going to change accordingly :). That's not so much a resolution issue as it is a geometry issue. So I don't really understand what you mean by this.