]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7994 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Feb 2026 18:27:47 +0000 (19:27 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Feb 2026 18:27:47 +0000 (19:27 +0100)
app/Console/Commands/UpdatePDFJSLibrary.php
app/Fluidbook/Compiler/PDF.php
app/Models/Traits/PublicationSettings.php

index 1a0ac0384a6dd1537203a8c2832fbd9dfa9869d3..cb1dadf619cb3a8237e60f0321d51bd8b515f4f4 100644 (file)
@@ -11,7 +11,7 @@ class UpdatePDFJSLibrary extends ToolboxCommand
     /** @see https://mozilla.github.io/pdf.js/getting_started/#download */
 
     protected $signature = 'updatepdfjs';
-    protected const VERSION = '5.4.149';
+    protected const VERSION = '5.4.624';
     //protected const VERSION = '3.11.174';
     protected const JQUERY_VERSION = '3.7.1';
 
index 943a1566ac10ae56f893de8792620e94d42e1b5c..dee94593bcc9826752e8fbd60b7ed6ec27844285 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace App\Fluidbook\Compiler;
 
+use Cubist\Util\CommandLine;
 use Cubist\Util\Text;
 
 trait PDF
@@ -51,6 +52,23 @@ trait PDF
         } else {
             $pdf = \App\Fluidbook\PDF::compilePDF($this->getFluidbook(), type: 'onlytexts');
         }
-        $this->vdir->copy($pdf, 'data/texts.pdf');
+
+        if ($this->fluidbookSettings->pdfToCanvasOutline) {
+            $outlines = str_replace('.pdf', '.outlines.pdf', $pdf);
+            if (!file_exists($outlines) || filemtime($outlines) < filemtime($pdf)) {
+                $gs = new CommandLine('gs');
+                $gs->setArg('o', $outlines);
+                $gs->setManualArg('-dNoOutputFonts');
+                $gs->setManualArg('-sDEVICE=pdfwrite');
+                $gs->setArg(null, $pdf);
+                $gs->execute();
+                $gs->debug();
+            }
+            $texts = $outlines;
+        } else {
+            $texts = $pdf;
+        }
+
+        $this->vdir->copy($texts, 'data/texts.pdf');
     }
 }
index 650ff5b7f321f5d4db0ba2903949b09f7cac4d7c..ad5072fa609a8350689c03e94e69438c149032ff 100644 (file)
@@ -445,6 +445,7 @@ trait PublicationSettings
             'default' => 0,
         ]);
         $this->_addSettingField('pdfToCanvasPDF', FilesOrURL::class, __('PDF pour le rendu PDF to Canvas'), ['when' => ['svgToCanvas' => 2]]);
+        $this->_addSettingField('pdfToCanvasOutline', Checkbox::class, __('Outline des texts du PDF'), ['when' => ['svgToCanvas' => 2], 'hint' => __('Permet de régler des problèmes de rendu de polices')]);
         $this->_addSettingField('svgToCanvasUpscale', Number::class, $this->__('Upscale de la fonction svgtocanvas'), [
             'default' => 1,
             'when' => ['svgToCanvas' => 1],