mirror of
https://github.com/24eme/signaturepdf
synced 2026-03-14 13:55:44 +01:00
watermark: check version of imagick
use `convert` if IM < 7, `magick` otherwise
This commit is contained in:
parent
75d295a2f6
commit
a416ebb287
1 changed files with 5 additions and 2 deletions
|
|
@ -198,9 +198,12 @@ class PDFSignature
|
|||
|
||||
public static function addFiligrane($text, $pdf)
|
||||
{
|
||||
// check version of imagick
|
||||
$command = (null === shell_exec("command -v magick")) ? 'convert' : 'magick';
|
||||
|
||||
// Création texte watermark
|
||||
$watermarkCommand = sprintf(
|
||||
'convert -density 144 -units PixelsPerInch pdf:%s_signe.pdf -write mpr:base \
|
||||
'%s -density 144 -units PixelsPerInch pdf:%s_signe.pdf -write mpr:base \
|
||||
\( -density 144 -units PixelsPerInch -background None -fill "#0007" -pointsize 20 label:%s -rotate -40 +repage -write mpr:TILE +delete \) \
|
||||
\( -clone 0 -tile mpr:TILE -draw "color 0,0 reset" -write mpr:TILES -delete 0 \) \
|
||||
-delete 0--1 \
|
||||
|
|
@ -210,7 +213,7 @@ class PDFSignature
|
|||
-sharpen 0x1.0 \
|
||||
-compress zip \
|
||||
pdf:%s_signe.pdf'
|
||||
, escapeshellarg($pdf), escapeshellarg($text), escapeshellarg($pdf));
|
||||
, $command, escapeshellarg($pdf), escapeshellarg($text), escapeshellarg($pdf));
|
||||
|
||||
shell_exec($watermarkCommand);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue