Detect broken font encodings and flag for OCR fallback

Add has_encoding_issues field to PdfProcessResult that detects garbled
text from broken ToUnicode CMaps (U+FFFD replacement characters or
systematic dollar-as-space substitution). Surfaced in JSON output so
clients can fall back to OCR for affected PDFs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Abimael Martell
2026-02-22 22:06:29 -08:00
co-authored by Claude Opus 4.6
parent a7dbb16e86
commit 8725e2b487
3 changed files with 112 additions and 11 deletions
+1
View File
@@ -950,6 +950,7 @@ fn test_pages_needing_ocr_field_accessible() {
title: None,
confidence: 1.0,
layout: pdf_inspector::LayoutComplexity::default(),
has_encoding_issues: false,
};
assert_eq!(process_result.pages_needing_ocr, vec![1, 3]);
}