From 08fc11e2d2abf00e22afd222a75bb66a13b6ec90 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 17 May 2022 17:50:40 +0200 Subject: [PATCH] wip #5220 @0.5 --- src/Process.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Process.php b/src/Process.php index f93c27f..6e39cdd 100644 --- a/src/Process.php +++ b/src/Process.php @@ -2,6 +2,8 @@ namespace Fluidbook\Farmer; +use Cubist\PDF\PDFTools; +use Cubist\Util\Files\Files; use Fluidbook\Tools\Document; use Fluidbook\Tools\Jobs\ProcessFile; use Fluidbook\Tools\Jobs\ProcessPage; @@ -114,12 +116,13 @@ class Process extends ProcessFile return str_replace(self::LOCAL_ROOT, self::DISTANT_ROOT, $this->getPath($this->isForce())); } - public function getJob(): ProcessPage + public function getSplittedPDFPage() { - if (null === $this->job) { - $this->job = new ProcessPage(new Document($this->getOut() . '/original.pdf'), $this->getPage(), [], false); + $res = $this->getOut() . 'pdf/p' . $this->getPage() . '.pdf'; + if (!file_exists($res)) { + PDFTools::split(Files::firstThatExists($this->getOut() . '/crop.pdf', $this->getOut() . '/fixed.pdf', $this->getOut() . '/original.pdf'), $this->getOut() . '/pdf'); } - return parent::getJob(); + return $res; } } \ No newline at end of file -- 2.39.5