1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Using php function to move and copy instead of shell

This commit is contained in:
Vincent LAURENT 2022-04-02 01:07:41 +02:00
parent 5b6d30a870
commit 0e891e1307

View File

@ -205,10 +205,11 @@ $f3->route('GET /signature/@hash/pdf',
if (!$layers) {
Web::instance()->send($originalFile, null, 0, TRUE, $filename);
}
copy($originalFile, $finalFile);
$bufferFile = str_replace('.pdf', '_tmp.pdf', $originalFile);
shell_exec(sprintf("cp %s %s", $originalFile, $finalFile));
foreach($layers as $layer) {
shell_exec(sprintf("pdftk %1\$s multistamp %2\$s output %3\$s && mv %3\$s %1\$s", $finalFile, $layer, $bufferFile));
foreach($layers as $layerFile) {
shell_exec(sprintf("pdftk %s multistamp %s output %s", $finalFile, $layerFile, $bufferFile));
rename($bufferFile, $finalFile);
}
Web::instance()->send($finalFile, null, 0, TRUE, $filename);
}