Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
fix(ocr): clean temp scans on text-only and ungate standalone image ocr
smjrifle0cb5e5629a9b
diff --git a/src/Filee.Engines/Ocr/ImageOcrConverter.cs b/src/Filee.Engines/Ocr/ImageOcrConverter.csindex 259c1049..5ca18689 100644--- a/src/Filee.Engines/Ocr/ImageOcrConverter.cs+++ b/src/Filee.Engines/Ocr/ImageOcrConverter.cs@@ -40,9 +40,9 @@ public sealed class ImageOcrConverter : IConverterpublic async Task<IReadOnlyList<string>> ConvertAsync(ConversionStep step, IProgress<double>? progress, CancellationToken cancellationToken){- if (!step.Preset.Document.Ocr)- throw new InvalidOperationException("OCR is disabled in preset settings.");-+ // Unlike PdfDocumentReader (where OCR is one option among several for an already-readable document),+ // this converter exists only because OCR is the sole way to get text out of an image: Document.Ocr+ // (off by default, so an ordinary PDF conversion isn't surprised by OCR) does not gate it.var language = step.Preset.Document.OcrLanguage;var engine = OcrEngineRegistry.GetDefault(language);if (engine is null || !engine.IsAvailable)diff --git a/src/Filee.Engines/Pdf/PdfDocumentReader.cs b/src/Filee.Engines/Pdf/PdfDocumentReader.csindex 07337741..e5460307 100644--- a/src/Filee.Engines/Pdf/PdfDocumentReader.cs+++ b/src/Filee.Engines/Pdf/PdfDocumentReader.cs@@ -412,7 +412,9 @@ internal sealed partial class PdfDocumentReader}finally{- if (isTempScan && words.Count > 0 && File.Exists(scanPath))+ // Kept only when it's about to become content.ScanPath below (words.Count == 0, !_textOnly);+ // every other outcome (OCR succeeded, or _textOnly never looks at ScanPath at all) is done with it.+ if (isTempScan && (words.Count > 0 || _textOnly) && File.Exists(scanPath)){try { File.Delete(scanPath); } catch { }}