]> _ Git - fluidbook_tools.git/commitdiff
wip #7871 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Jan 2026 10:18:39 +0000 (11:18 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Jan 2026 10:18:39 +0000 (11:18 +0100)
src/Links/Link.php
src/Links/PDFFormPopupLink.php [new file with mode: 0644]

index 470cd9d119b41779c1ef8f9751b55cd69bf6474e..527fab1e839ac22ad4d72b20a6da2fde8441ef1d 100644 (file)
@@ -75,6 +75,7 @@ class Link
     const PAGE_BACKGROUND_COLOR = 48;
     const FLUIDBOOK_TOOLBOX_ELEARNING_CONTENT = 49;
     const LAYER_MASK = 50;
+    const PDF_FORM = 51;
 
     protected static string|false|null $_linksKey = null;
     public $left;
@@ -364,6 +365,8 @@ class Link
                 return new PDFPopupLink($id, $init, $compiler);
             case static::PDF_INLINE:
                 return new PDFInlineLink($id, $init, $compiler);
+            case static::PDF_FORM:
+                return new PDFFormPopupLink($id, $init, $compiler);
             case static::COPY_TO_CLIPBOARD:
                 return new CopyToClipboardLink($id, $init, $compiler);
             case static::PAGE_BACKGROUND_COLOR:
diff --git a/src/Links/PDFFormPopupLink.php b/src/Links/PDFFormPopupLink.php
new file mode 100644 (file)
index 0000000..4eb342a
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace Fluidbook\Tools\Links;
+
+use Cubist\Util\Graphics\Image;
+use Cubist\PDF\PDFTools;
+
+class PDFFormPopupLink extends NormalLink {
+    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;
+    }
+}