]> _ Git - fluidbook_processfarm.git/commitdiff
#7894
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 14:13:38 +0000 (15:13 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 14:13:38 +0000 (15:13 +0100)
app/process.php
app/src/AssetsOperations.php [new file with mode: 0644]

index 083bf8638a84761d52153bdbe9f0255a6f3e391f..092c97cf49c3a0f60df4e992ab53f2f6811d4f4c 100644 (file)
@@ -4,6 +4,7 @@ use Fluidbook\Farmer\PDFOperations;
 use Fluidbook\Farmer\ProcessFile;
 use Fluidbook\Farmer\ProcessToolboxDocumentFile;
 use Fluidbook\Farmer\ProcessToolboxPDFFile;
+use Fluidbook\Farmer\AssetsOperations;
 
 require_once __DIR__ . "/vendor/autoload.php";
 
@@ -20,7 +21,9 @@ if (!isset($_POST['operation'])) {
 }
 
 try {
-    if ($_POST['operation'] === 'fixpdf') {
+    if ($_POST['operation'] === 'ocr') {
+        $res = AssetsOperations::OCR($_POST['file'], $_POST['locale']);
+    } else if ($_POST['operation'] === 'fixpdf') {
         $res = PDFOperations::fixPDF($_POST['pdf'], $_POST['out']);
     } else if ($_POST['operation'] === 'cutpdf') {
         $res = PDFOperations::cutPDF($_POST['pdf'], $_POST['mode'], $_POST['out']);
diff --git a/app/src/AssetsOperations.php b/app/src/AssetsOperations.php
new file mode 100644 (file)
index 0000000..b96e20a
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace Fluidbook\Farmer;
+
+use Cubist\Util\CommandLine\Docling;
+
+class AssetsOperations
+{
+    public static function OCR($file, $locale = null)
+    {
+        return Docling::OCR($file, $locale, true);
+    }
+}
\ No newline at end of file