Fix: Form-Feed-Zeichen von pdftotext verhinderte OCR-Fallback [deploy]
All checks were successful
Deploy mahnung / deploy (push) Successful in 14s

pdftotext gibt bei Bild-PDFs 0x0C (Form Feed) zurück — trim() entfernt
das nicht. Dadurch wurde der OCR-Fallback nie ausgelöst.
Jetzt trim() mit expliziter Zeichenliste inkl. \x0C.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-05-13 16:55:24 +02:00
parent f776d121c5
commit 7157f0d8c3

View file

@ -206,7 +206,7 @@ if ($action === 'scan_belege' && $user->hasRight('mahnung', 'write')) {
if ($pdftotextAvailable) {
// Erst normales pdftotext versuchen
$cmd = 'pdftotext -layout '.escapeshellarg($file['fullname']).' - 2>/dev/null';
$text = trim((string) @shell_exec($cmd));
$text = trim((string) @shell_exec($cmd), " \t\n\r\0\x0B\x0C");
// Kein Text? → OCR via ocrmypdf (Bild-PDF lesbar machen)
if ($text === '') {