Forum


Replies: 1   Views: 496
Adding image when signing pdf
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by rabol  · 10-05-2023 - 15:53

Hi

What unit is used for the image size when adding image during signing a PDF

The documentation  just say w and h, so I tried 150 (my image is 150px), but it got very big

Also the background became black - the png has transparent background, how do I keep it like that ?

and the link that I added did not have any effect, maybe I missunderstand the meaning, but I would have expected that the link would open a browser

 

Posted by admin  · 10-05-2023 - 17:59

Hello,

PDF files don't use px but pt/mm units. Please use a lower value, px units are not transformed.

Regarding your question, if you are adding a signature in the same position than the image, then the signature link information has greater importance than the image link.
You can test it adding the signature and the image using distinct positions:

$optionsSignature = array(
    'x' => 100,
    'y' => 200,
    'w' => 50,
    'h' => 50,
    'page' => 1,
);

$optionsImage = array(
    'src' => 'image.png',
    'link' => 'https://www.phpdocx.com',
    'x' => 0,
    'y' => 200,
    'w' => 50,
    'h' => 50,
);

$sign->sign('output.pdf', $optionsSignature, $optionsImage);

We also recommend you use Adobe Reader, Foxit Reader or another PDF reader that includes support for signatures. The internal PDF reader of Google Chrome has many limitations.

We have tested a transparent PNG and it's added correctly. Maybe the image uses a transparency format not supported by PHP?

Regards.