From 4fd8740a82122ba8a74d77d8acdbc2a3ac377bc3 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 15 Jul 2024 15:40:24 +0200 Subject: [PATCH] wip #7005 @1 --- src/Jobs/ProcessFile.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Jobs/ProcessFile.php b/src/Jobs/ProcessFile.php index 4bd729a..fe036b6 100644 --- a/src/Jobs/ProcessFile.php +++ b/src/Jobs/ProcessFile.php @@ -9,6 +9,8 @@ use Fluidbook\Tools\SVG\SVGTools; class ProcessFile { + const EMPTY_SVG = ''; + protected $format = 'jpg'; /** * @var int|string @@ -267,11 +269,17 @@ class ProcessFile return $svgFile; } PDFTools::makeBaseSVGFile($this->getSplittedPDFPage(), $svgFile, 1); + if (file_exists($svgFile) && filesize($svgFile) == 0) { + file_put_contents($svgFile, static::EMPTY_SVG); + } return $svgFile; } protected function _isSVGValid($file) { + if (!file_exists($file) || filesize($file) === 0) { + return false; + } $svg = new DOMDocument(); $svg->preserveWhiteSpace = false; $svg->load($file, LIBXML_PARSEHUGE); -- 2.39.5