]> _ Git - fluidbook_processfarm.git/commitdiff
wip #5220 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 May 2022 15:50:40 +0000 (17:50 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 May 2022 15:50:40 +0000 (17:50 +0200)
src/Process.php

index f93c27f84d3c910791f7dd0c86e47639c91c0ab8..6e39cdd18addb15bf52a0f4a7530ec6fe56424ef 100644 (file)
@@ -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