From: Vincent Vanwaelscappel Date: Wed, 19 Jan 2022 12:56:09 +0000 (+0100) Subject: wip #4804 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=cd178fcfa33226d2840ac9b5c64c14fb0b630566;p=cubist_pdf.git wip #4804 @0.5 --- diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/Document.php b/src/Document.php index c3a006e..da341c1 100644 --- a/src/Document.php +++ b/src/Document.php @@ -69,12 +69,18 @@ class Document return; } - $fwstk = new FWSTK(); - $fwstk->setArg('--input ' . $this->getPDFInput()); - $fwstk->setArg('--infos'); - $fwstk->execute(); + $nfoFile = $this->getConvertPath() . 'infos'; - $infos = $fwstk->getOutput(); + if (!file_exists($nfoFile) || filesize($nfoFile) === 0 || filemtime($nfoFile) < filemtime($this->getPDFInput())) { + $fwstk = new FWSTK(); + $fwstk->setArg('--input ' . $this->getPDFInput()); + $fwstk->setArg('--infos'); + $fwstk->execute(); + + $infos = $fwstk->getOutput(); + } else { + $infos = file_get_contents($nfoFile); + } if (preg_match('/Pages:\s*(\d+)/', $infos, $matches)) {