Verified Commit 5baaa5fd authored by Damien's avatar Damien

FEAT #13794 TIME 2:20 Form pdf

parent 987225ae
......@@ -186,7 +186,7 @@ class ConvertThumbnailController
/**
* [Choose between graphicImage and imageMagics]
*/
public function getConvertCommand() {
public static function getConvertCommand() {
$command = 'gm version';
......
......@@ -315,6 +315,27 @@ class DocumentController
return $response->withStatus(500)->withJson(['errors' => $encodedDocument['errors']]);
}
if (is_file('vendor/SetaPDF-FormFiller-Full_2.33.0.1425/library/SetaPDF/Autoload.php')) {
require_once 'vendor/SetaPDF-FormFiller-Full_2.33.0.1425/library/SetaPDF/Autoload.php';
$targetFile = CoreConfigModel::getTmpPath() . "tmp_file_{$GLOBALS['id']}_" .rand(). "_target_watermark.pdf";
$flattenedFile = CoreConfigModel::getTmpPath() . "tmp_file_{$GLOBALS['id']}_" .rand(). "_watermark.pdf";
file_put_contents($targetFile, base64_decode($encodedDocument['encodedDocument']));
$writer = new \SetaPDF_Core_Writer_File($flattenedFile);
$document = \SetaPDF_Core_Document::loadByFilename($targetFile, $writer);
$formFiller = new \SetaPDF_FormFiller($document);
$fields = $formFiller->getFields();
$fields->flatten();
$document->save()->finish();
$file = file_get_contents($flattenedFile);
$encodedDocument['encodedDocument'] = base64_encode($file);
unlink($flattenedFile);
unlink($targetFile);
}
try {
$storeInfos = DocserverController::storeResourceOnDocServer([
'encodedFile' => $encodedDocument['encodedDocument'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment