]> _ Git - cubist_pdf.git/commitdiff
wip #6188 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Sep 2023 14:34:37 +0000 (16:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Sep 2023 14:34:37 +0000 (16:34 +0200)
src/PDFTools.php

index 60d98f77a2b78ac1f0c3a640fcfc1659afc031be..97404857607c007ffdf1e14d61e5c4383790f9c6 100644 (file)
@@ -442,6 +442,15 @@ class PDFTools
     public static function extractTexts($pdf, $out, $mode = 'standard', $textExtraction = 'fluidbook', $ignoreSeparators = '')
     {
         $out .= 'texts';
+
+        if (!$mode) {
+            $mode = 'standard';
+        }
+        if ($mode === 'robust') {
+            $textExtraction = 'fluidbook';
+            $ignoreSeparators = "";
+        }
+
         if ($ignoreSeparators) {
             $out .= '/sep_' . md5($ignoreSeparators);
         }
@@ -452,6 +461,8 @@ class PDFTools
         $fwstk->setArg('--extractTexts ' . $out . '%s%d.txt');
         $fwstk->setArg('--extractTextsMethod ' . $textExtraction);
         $fwstk->setArg('--threads 1');
+        $fwstk->setArg('--mode ' . $mode);
+
         if ($ignoreSeparators) {
             $fwstk->setArg('--ignoreSeparators "' . $ignoreSeparators . '"');
         }