From: Vincent Vanwaelscappel Date: Tue, 17 May 2022 15:50:40 +0000 (+0200) Subject: wip #5220 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=08fc11e2d2abf00e22afd222a75bb66a13b6ec90;p=fluidbook_processfarm.git wip #5220 @0.5 --- 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