$infos = json_decode(file_get_contents($infosfile));
}
- $this->copyExternalFile($this->to);
+ $cut = $this->wdir . $name . '.c.pdf';
+ if (true || !file_exists($cut)) {
+ $ratio = $infos->width / $infos->height;
+ $nb = max(1, ceil(0.7 / $ratio));
+
+ if ($nb == 1) {
+ copy($pdffile, $cut);
+ } else {
+ `mutool poster -y $nb $pdffile $cut`;
+ }
+ }
+
+ $this->copyExternalFile($name . '.c.pdf');
$text = file_get_contents($htmlfile);
- $this->article = ['page' => $this->page, 'type' => 'pdf', 'id' => $name, 'url' => $name, 'infos' => $infos, 'content' => $this->to, 'textcontent' => $text];
+ $this->article = ['page' => $this->page, 'type' => 'pdf', 'id' => $name, 'url' => $name, 'infos' => $infos, 'content' => $name . '.c.pdf', 'textcontent' => $text];
$this->compiler->config->articlesList[] = $this->article;
$this->compiler->addSEOArticle('#/article/' . $name, $this->title, $this->description, '', $name, $name . '.html', $text);
}