]> _ Git - fluidbook_tools.git/commitdiff
wip #7871 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 Jan 2026 17:12:56 +0000 (18:12 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 Jan 2026 17:12:56 +0000 (18:12 +0100)
src/Links/PDFFormPopupLink.php
src/Links/PDFPopupLink.php

index 4eb342a98d4e01536c19a3ab0aae9f9917fcc04f..8412ef0d41fd041e7fb6aa100d95db1ee1b6a6d3 100644 (file)
@@ -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;
     }
 }
index 9bb73c766c81f3d497c07b7e34fd97eb6c43f3a8..6eb1ee06da25bcf8f911b61ecb998e2675818893 100644 (file)
@@ -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];
     }
 }