]> _ Git - cubist_pdf.git/commitdiff
wip #6615 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Jan 2024 18:22:36 +0000 (19:22 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 16 Jan 2024 18:22:36 +0000 (19:22 +0100)
src/PDFTools.php

index 30a90eca584026306e9e257cdd93f2dedd65a84f..3d63db4df4e96425b19ffa04d3fd186ac8ec1dad 100644 (file)
@@ -393,6 +393,20 @@ class PDFTools
         $pdftoppm->execute();
         $tmp .= '.ppm';
 
+        $output = $pdftoppm->getOutput();
+        $errors = ['end of file inside dictionary',
+            'leftover args in content stream',
+            'document stream is empty'
+        ];
+
+        foreach ($errors as $error) {
+            if (stristr($output, $error)) {
+                unlink($tmp);
+                $pdftoppm->debug();
+                return;
+            }
+        }
+
 
         if (file_exists($tmp)) {
             if ($format === 'jpg') {