]> _ Git - cubist_util.git/commitdiff
wip #7894 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 14:07:37 +0000 (15:07 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 14:07:37 +0000 (15:07 +0100)
src/CommandLine/Docling.php

index c64274976644bdc395f75354e9c3462923830ae1..73bebbc224326cbcc25d858b18e55e6fefcc0057 100644 (file)
@@ -15,7 +15,7 @@ class Docling extends CommandLine
         parent::__construct('docling', $output, $error, $outputPrefix);
     }
 
-    public static function OCR($image, $locale = null)
+    public static function OCR($image, $locale = null, $returnFile = false)
     {
         $f = new \SplFileInfo($image);
 
@@ -36,8 +36,11 @@ class Docling extends CommandLine
 
             $html = Markdown::toHTML($md, false);
             file_put_contents($out, $html);
-            return $html;
         }
-        return file_get_contents($out);
+        if ($returnFile) {
+            return $out;
+        } else {
+            return $html ?? file_get_contents($out);
+        }
     }
 }
\ No newline at end of file