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);