From: Vincent Vanwaelscappel Date: Wed, 5 Feb 2025 11:29:21 +0000 (+0100) Subject: wait #7306 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=013ed056fb5998f2839e800e7ceb02305e051478;p=fluidbook_tools.git wait #7306 @0.5 --- diff --git a/src/Links/ArticlePDFLink.php b/src/Links/ArticlePDFLink.php index 0f4d331..c7fe66d 100644 --- a/src/Links/ArticlePDFLink.php +++ b/src/Links/ArticlePDFLink.php @@ -4,28 +4,34 @@ namespace Fluidbook\Tools\Links; use Cubist\Util\Graphics\Image; -class ArticlePDFLink extends ArticleLink { +class ArticlePDFLink extends ArticleLink +{ public $title = ''; public $description = ''; - public function init() { - $this->compiler->addPDFJS(true); - - $wdir=$this->compiler->getWorkingDir(); + public function init() + { + $wdir = $this->compiler->getWorkingDir(); $e = explode('.', $this->to); array_pop($e); $name = implode('.', $e); - $pdffile =$wdir . $this->to; + $pdffile = $wdir . $this->to; + if (!file_exists($pdffile)) { + $this->compiler->addIssue(15, ['file' => $pdffile, 'uid' => $this->uid, 'page' => $this->page]); + return; + } $mtime = filemtime($pdffile); - $htmlfile =$wdir . $name . '.html'; + $this->compiler->addPDFJS(true); + + $htmlfile = $wdir . $name . '.html'; if (!file_exists($htmlfile) || filemtime($htmlfile) < $mtime) { $cmd = "pdftotext -f 1 -l 1 -htmlmeta $pdffile $htmlfile"; `$cmd`; } - $cut =$wdir . $name . '.c.pdf'; + $cut = $wdir . $name . '.c.pdf'; $size = $wdir . $name . '.s.pdf'; $dim = Image::getimagesize($pdffile);