From 33b95e795e46cdb16904822715eb8f22329b1551 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 6 Jan 2026 18:12:56 +0100 Subject: [PATCH] wip #7871 @1 --- src/Links/PDFFormPopupLink.php | 24 +++++++++++++----------- src/Links/PDFPopupLink.php | 21 +++++++++++++++------ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/Links/PDFFormPopupLink.php b/src/Links/PDFFormPopupLink.php index 4eb342a..8412ef0 100644 --- a/src/Links/PDFFormPopupLink.php +++ b/src/Links/PDFFormPopupLink.php @@ -5,19 +5,21 @@ namespace Fluidbook\Tools\Links; use Cubist\Util\Graphics\Image; use Cubist\PDF\PDFTools; -class PDFFormPopupLink extends NormalLink { - public function getDefaultTooltip() { +class PDFFormPopupLink extends PDFPopupLink +{ + protected $_baseURL = 'pdfform'; + + public function getDefaultTooltip() + { return 'click to fill the form'; } - /** - * @throws \Exception - */ - public function getURL() { - $this->compiler->addPDFJS(true); - $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to); - $this->compiler->config->set('pdfLinks.' . $this->uid, ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs]); - $this->copyExternalFile($this->to); - return '#/pdfform/' . $this->uid; + protected function _getPDFInfos() + { + $res = parent::_getPDFInfos(); + $res['recipient'] = $this->target; + $res['name'] = $this->name; + + return $res; } } diff --git a/src/Links/PDFPopupLink.php b/src/Links/PDFPopupLink.php index 9bb73c7..6eb1ee0 100644 --- a/src/Links/PDFPopupLink.php +++ b/src/Links/PDFPopupLink.php @@ -5,19 +5,28 @@ namespace Fluidbook\Tools\Links; use Cubist\Util\Graphics\Image; use Cubist\PDF\PDFTools; -class PDFPopupLink extends NormalLink { - public function getDefaultTooltip() { +class PDFPopupLink extends NormalLink +{ + protected $_baseURL='pdf'; + public function getDefaultTooltip() + { return 'click to open the document'; } /** * @throws \Exception */ - public function getURL() { + public function getURL() + { $this->compiler->addPDFJS(true); - $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to); - $this->compiler->config->set('pdfLinks.' . $this->uid, ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs]); + $this->compiler->config->set('pdfLinks.' . $this->uid, $this->_getPDFInfos()); $this->copyExternalFile($this->to); - return '#/pdf/' . $this->uid; + return '#/'.$this->_baseURL.'/' . $this->uid; + } + + protected function _getPDFInfos() + { + $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to); + return ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs]; } } -- 2.39.5