]> _ Git - cubist_pdf.git/commitdiff
wip #4804 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Oct 2021 07:52:53 +0000 (09:52 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Oct 2021 07:52:53 +0000 (09:52 +0200)
src/Document.php
src/PDFTools.php

index b6683e1dcfd1e3040c9e186a88aeac0a931032b3..c3a006e6bb79225bdb4fa040d8dc2b02712811df 100644 (file)
@@ -157,9 +157,9 @@ class Document
         PDFTools::extractHighlightsData($this->getPDFInput(), $this->getConvertPath());
     }
 
-    public function processFullTexts()
+    public function processFullTexts($force = true)
     {
-        PDFTools::extractTexts($this->getPDFInput(), $this->getConvertPath());
+        PDFTools::extractTexts($this->getPDFInput(), $this->getConvertPath(), '', $force);
     }
 
     public function getPageNumbers()
index 8469b0c737acb35a31d0670e6a592cd09aa00ac1..4c88e3a55e03c11e6e8c9d04cd8e8c092b53cedd 100644 (file)
@@ -326,11 +326,15 @@ class PDFTools
         $fwstk->execute();
     }
 
-    public static function extractTexts($pdf, $out, $ignoreSeparators = '')
+    public static function extractTexts($pdf, $out, $ignoreSeparators = '', $force = true)
     {
         $out .= 'texts/';
         Files::mkdir($out);
 
+        if (!$force && file_exists($out . 'fp1.txt')) {
+            return;
+        }
+
         $fwstk = new FWSTK();
         $fwstk->setArg('--input ' . $pdf);
         $fwstk->setArg('--extractTexts ' . $out . '%s%d.txt');