From a7ce3eae4462347d9ae238705e44df7360d6862c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 22 Feb 2023 08:27:27 +0100 Subject: [PATCH] wip #5524 @0.5 --- app/process.php | 15 ++++++--- app/src/ProcessFile.php | 6 +++- ...ing.php => ProcessToolboxDocumentFile.php} | 2 +- app/src/ProcessToolboxPDFFile.php | 31 +++++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) rename app/src/{ProcessFileNoMapping.php => ProcessToolboxDocumentFile.php} (74%) create mode 100644 app/src/ProcessToolboxPDFFile.php diff --git a/app/process.php b/app/process.php index 87ab21c..0dcc04e 100644 --- a/app/process.php +++ b/app/process.php @@ -1,15 +1,20 @@ process()); \ No newline at end of file diff --git a/app/src/ProcessFile.php b/app/src/ProcessFile.php index c9eeb66..424737a 100644 --- a/app/src/ProcessFile.php +++ b/app/src/ProcessFile.php @@ -131,10 +131,14 @@ class ProcessFile extends \Fluidbook\Tools\Jobs\ProcessFile { } } + public function getPdf(): string { + return Files::firstThatExists($this->getOut() . '/crop.pdf', $this->getOut() . '/fixed.pdf', $this->getOut() . '/original.pdf'); + } + public function getSplittedPDFPage() { $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'); + PDFTools::split($this->getPdf(), $this->getOut() . '/pdf'); } return $res; } diff --git a/app/src/ProcessFileNoMapping.php b/app/src/ProcessToolboxDocumentFile.php similarity index 74% rename from app/src/ProcessFileNoMapping.php rename to app/src/ProcessToolboxDocumentFile.php index d48c05e..4476313 100644 --- a/app/src/ProcessFileNoMapping.php +++ b/app/src/ProcessToolboxDocumentFile.php @@ -3,7 +3,7 @@ namespace Fluidbook\Farmer; -class ProcessFileNoMapping extends ProcessFile{ +class ProcessToolboxDocumentFile extends ProcessFile{ public function getOut() { $this->getDistantOut(); } diff --git a/app/src/ProcessToolboxPDFFile.php b/app/src/ProcessToolboxPDFFile.php new file mode 100644 index 0000000..baa8fd1 --- /dev/null +++ b/app/src/ProcessToolboxPDFFile.php @@ -0,0 +1,31 @@ +setPdf($pdf); + parent::__construct($out, $page, $resolutionRatio, $mobileRatio, $format, $resolution, $withGraphics, $withTexts, $version, $force); + } + + /** + * @return string + */ + public function getPdf(): string { + return $this->_pdf; + } + + /** + * @param string $pdf + */ + public function setPdf(string $pdf): void { + $this->_pdf = $pdf; + } +} \ No newline at end of file -- 2.39.5