]> _ Git - fluidbook_tools.git/commitdiff
wip #4808 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Oct 2021 16:43:53 +0000 (18:43 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Oct 2021 16:43:53 +0000 (18:43 +0200)
src/Compiler/Compiler.php
src/Compiler/Source.php
src/Document.php [new file with mode: 0644]
src/Jobs/ProcessPage.php

index 7169c8289d9308fdf5e9c3f638da8f90a7e6ea5d..299e246a4b8a948fcfd1f0f6d6689547936a507f 100644 (file)
@@ -6,9 +6,9 @@ use Cubist\Util\Files\Files;
 use Cubist\Util\Files\VirtualDirectory;
 use Cubist\Util\PHP;
 use Exception;
+use Fluidbook\Tools\Document;
 use Fluidbook\Tools\Jobs\ProcessFile;
 use Fluidbook\Tools\Jobs\ProcessPage;
-use Cubist\PDF\Document;
 use Fluidbook\Tools\Search\SearchIndex;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldBeUnique;
index 81e85c0fc6f2a1c2c5c97095819224c325351328..d875941cd582045e447b5c4a2fecd48efc460343 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Fluidbook\Tools\Compiler;
 
-use Cubist\PDF\Document;
+use Fluidbook\Tools\Document;
 
 class Source
 {
diff --git a/src/Document.php b/src/Document.php
new file mode 100644 (file)
index 0000000..6642cc7
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace Fluidbook\Tools;
+
+use Fluidbook\Tools\Jobs\ProcessFile;
+use Fluidbook\Tools\Jobs\ProcessPage;
+
+class Document extends \Cubist\PDF\Document
+{
+    /**
+     * @param ProcessFile[] $files
+     * @param array $pages
+     * @param bool $sync
+     */
+    public function processPages($files, $pages, $sync = false)
+    {
+        start_measure('Process pages (doc)');
+        foreach ($pages as $i) {
+            $this->processPage($i, $files, $sync);
+        }
+        stop_measure('Process pages (doc)');
+    }
+
+    /**
+     * @param $page int
+     * @param $dest string
+     * @param $files ProcessFile[]
+     * @param false $sync
+     */
+    public function processPage($page, $files, $sync = false)
+    {
+        $dispatchFunction = $sync ? 'dispatchSync' : 'dispatch';
+        ProcessPage::$dispatchFunction($this, $page, $files);
+    }
+}
index 35855809f87028e81e35cedfd5e942d4bd17962a..2c3ea35720239238a740f8c58eaedbf27db6a659 100644 (file)
@@ -3,7 +3,7 @@
 namespace Fluidbook\Tools\Jobs;
 
 use Cubist\Util\Files\Files;
-use Cubist\PDF\Document;
+use Fluidbook\Tools\Document;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Foundation\Bus\Dispatchable;