From 03b206ec17e5945fa5f74d7804d3138c94b2b790 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 16 Jan 2024 20:13:09 +0100 Subject: [PATCH] wip #6615 @0.25 --- src/PDFTools.php | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/PDFTools.php b/src/PDFTools.php index 740f4be..fe384a2 100644 --- a/src/PDFTools.php +++ b/src/PDFTools.php @@ -393,26 +393,27 @@ class PDFTools $pdftoppm->execute(); $tmp .= '.ppm'; -// $output = $pdftoppm->getOutput(); -// $errors = ['end of file inside dictionary', -// 'leftover args in content stream', -// 'document stream is empty', -// 'premature end of data segment', -// 'corrupt jpeg data', -// 'couldn\'t find trailer dictionary', -// 'invalid xref entry', -// 'incorrect stream length', -// 'try to reconstruct', -// 'error opening pdf file', -// ]; -// -// foreach ($errors as $error) { -// if (stristr($output, $error)) { -// unlink($tmp); -// $pdftoppm->debug(); -// return; -// } -// } + $output = $pdftoppm->getOutput(); + $errors = [ + //'end of file inside dictionary', + 'leftover args in content stream', + 'document stream is empty', + //'premature end of data segment', + //'corrupt jpeg data', + //'couldn\'t find trailer dictionary', + //'invalid xref entry', + //'incorrect stream length', + //'try to reconstruct', + //'error opening pdf file', + ]; + + foreach ($errors as $error) { + if (stristr($output, $error)) { + unlink($tmp); + $pdftoppm->debug(); + return; + } + } if (file_exists($tmp)) { -- 2.39.5