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