]> _ Git - cubist_pdf.git/commitdiff
wip #5410 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 19:08:52 +0000 (21:08 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 19:08:52 +0000 (21:08 +0200)
src/PDFTools.php

index a004b67293300d74fc11392082cd98d35b4698ea..8b92e6797329752eb9b2193d9ff67d02ebb0fa73 100644 (file)
@@ -409,19 +409,18 @@ class PDFTools
         $fwstk->execute();
     }
 
-    public static function extractTexts($pdf, $out, $ignoreSeparators = '', $force = true)
+    public static function extractTexts($pdf, $out, $textExtraction, $ignoreSeparators = '')
     {
         $out .= 'texts/';
-        Files::mkdir($out);
-
-        if (!$force && file_exists($out . 'fp1.txt')) {
-            return;
+        if ($ignoreSeparators) {
+            $out .= 'sep_' . md5($ignoreSeparators);
         }
+        $out = Files::mkdir($out) . '/';
 
         $fwstk = new FWSTK();
         $fwstk->setArg('--input ' . $pdf);
         $fwstk->setArg('--extractTexts ' . $out . '%s%d.txt');
-        $fwstk->setArg('--extractTextsMethod fluidbook');
+        $fwstk->setArg('--extractTextsMethod' . $textExtraction);
         $fwstk->setArg('--threads 1');
         if ($ignoreSeparators !== '') {
             $fwstk->setArg('--ignoreSeparators ' . $ignoreSeparators);