From eb4f285fa3e4ba04a965c9b89a9f983e3aca7f02 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 29 Mar 2022 12:51:58 +0200 Subject: [PATCH] wip #5184 @1 --- src/Compiler/Compiler.php | 5 +++++ src/Document.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Compiler.php b/src/Compiler/Compiler.php index 57fd9df..76e4b5a 100644 --- a/src/Compiler/Compiler.php +++ b/src/Compiler/Compiler.php @@ -15,6 +15,7 @@ use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\Jobs\Job; use Illuminate\Queue\Jobs\SyncJob; use Illuminate\Queue\SerializesModels; use JsonException; @@ -65,6 +66,7 @@ class Compiler implements ShouldQueue, ShouldBeUnique */ protected $resolutions = [150, 300]; + public function addSource($document, $start = 1, $pages = null) { $source = new Source(new Document($document), $start, $pages); @@ -93,6 +95,9 @@ class Compiler implements ShouldQueue, ShouldBeUnique } start_measure('Process Fluidbook'); + // Launch async conversion of pages. Some pages will be processed while the following sync process will attempt other conversion + $this->processPages(false); + // $this->processPages($sync); $this->getTexts(); $this->compileFluidbook(); diff --git a/src/Document.php b/src/Document.php index bb2f5f7..6086d7b 100644 --- a/src/Document.php +++ b/src/Document.php @@ -32,10 +32,11 @@ class Document extends \Cubist\PDF\Document * @param $dest string * @param $files ProcessFile[] * @param false $sync + * @return ProcessPage */ public function processPage($page, $files, $sync = false) { $dispatchFunction = $sync ? 'dispatchSync' : 'dispatch'; - ProcessPage::$dispatchFunction($this, $page, $files); + return ProcessPage::$dispatchFunction($this, $page, $files); } } -- 2.39.5