Closed lemsn closed 1 year ago
Hi,
the "problem" of that document is that the pages are already rotated 90 degrees, and how PDF works... if the page is rotated, the image should be rotated too, but sapp does not provide support for rotating images, at this moment.
Sorry.
But I use another tool for signature: TCPDI, and the signature picture is not rotated.
signature pdf file:
94cd0147-7810-421c-a0fc-4c91d07e47c6.pdf
What is the reason for this.
Hi,
sorry, but I do not know about the internals of TCPDI. Perhaps they rotate the image.
No, that's not what it means. With their tool, the image doesn't rotate, but when I used SAPP, sometime , the image rotated,
So, my solution is to rebuild my PDF file using TCPDF, and then use SAPP to sign my new PDF. This solves two problems:
I still enjoy using SAPP. Can you help with that in future releases?
In addition, I also found the location and size of sapp's signature pictures inconvenient, so I used the method of TCPDF for your reference and improvement:
/ *
// Add the following method to line 13567: \vendor\tecnickcom\ TCPDF \tcpdf.php
public function getAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') {
return $this->getSignatureAppearanceArray($x, $y, $w, $h, $page, $name);
}
* /
$this->pdf = new TCPDI(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$Appearance = $this->pdf->getAppearance(130, 150, 40, 40);
PS:
130 The X coordinate of the picture
150 The Y coordinate of the picture
40 Image width
40 Image height
By this calculation, we get: rect
$rect = explode(' ',$Appearance['rect']);
$x = $rect[0];
$y = $rect[1];
$w = $rect[2];
$h = $rect[3];
// Set the image appearance and certificate file
$obj ->set_signature_appearance(0, [ $x, $y, $w, $h ], $image);
//$obj->set_signature_appearance(0, [ $p_x, $p_y, $p_x + $i_w, $p_y + $i_h ], $image);
$obj ->et_signature_certificate($cert, $password);
If you have managed to solve the problem... are you willing to contribute to the code via pull request?
So, my solution is to rebuild my PDF file using TCPDF, and then use SAPP to sign my new PDF. This solves two problems:
- Picture rotation problem 2, sometimes, read PDF: the Error on the read some PDF: Invalid string (Error on read some PDF:Invalid string #10).
I still enjoy using SAPP. Can you help with that in future releases?
I have created a solution for #10. Could you please test it?
`
`
If you have managed to solve the problem... are you willing to contribute to the code via pull request?
code file:
What is Token:
I have a file with several pages in pdf, I wanted to put the graphic signature on each one as $obj->set_signature_appearance(0, [ $p_x, $p_y, $p_x + $i_w, $p_y + $i_h ], $image); I created a loop but it is only on the last page. Would you like to do that?
Hi, sorry but according to the PDF structure, each signature can appear only once per signature process. So calling set_signature_appearance
simply updates the placement.
Hi @lemsn
I have added a solution to the rotated appearance issue. Would you like to try it?
closing it because there is no activity and seems to be solved
Why does the signature picture automatically turn 90 degrees clockwise?
The original picture looks like this