]> _ Git - cubist_pdf.git/commitdiff
wip #7556 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Jul 2025 12:18:27 +0000 (14:18 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 29 Jul 2025 12:18:27 +0000 (14:18 +0200)
src/PDFTools.php

index 1019eb16c7fee97365e625fb8d9e56b671892e53..948d1d41f4191695884a27e143e5765fb36094fc 100644 (file)
@@ -596,11 +596,16 @@ class PDFTools
 
     public static function extractMarkdown($pdf, $out)
     {
+        $dir = Files::mkdir($out . '/docling');
         $docling = new CommandLine('python');
         $docling->setArg(null, self::resource_path('tools/docling/convert_page.py'));
         $docling->setArg(null, $pdf);
-        $docling->setArg(null, Files::mkdir($out . '/docling'));
+        $docling->setArg(null, $dir);
         $docling->execute();
+        if (!file_exists($dir . 'p1.md')) {
+            throw new \Exception('An error occured during docling process : ' . $docling->getOutput() . ' // ' . $docling->getCommand());
+        }
+
         $docling->debug();
     }