0

I have a lot of scans of documents in which spaces and indentation are important, and I am trying to find an OCR solution that would correctly process the formatting with an output of a .txt file. So far I have tried tesseract and google cloud vision(both work poorly with formatting) as well as abbyy Finereader(the best solution so far, the formatting is preserved with .docx and .rtf output but, but isn't for .txt files)

4
  • Are you looking for a library to create an application with this, or something end-user ready? Do you have a budget or are you looking for something available at no cost? Mar 26 at 13:49
  • All solutions are welcome. Mar 26 at 15:57
  • Welcome! Do you have an OS requirement? Mar 28 at 0:22
  • Preferably windows Mar 28 at 20:33
0

If you're looking to develop a commercial product, the LEADTOOLS SDK can output to text with an option to insert spaces to try to retain the layout of the input page. https://www.leadtools.com/help/sdk/v21/dh/ft/textdocumentoptions.html

public static void WriteText(string inputFilename, string outputFilename)
{
 IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);
 ocrEngine.Startup(null, null, null, null);

 using (IOcrDocument document = ocrEngine.DocumentManager.CreateDocument())
 {
    IOcrPage page = document.Pages.AddPage(inputFilename, null);
    page.AutoZone(null);
    page.Recognize(null);

    TextDocumentOptions options = ocrEngine.DocumentWriterInstance.GetOptions(DocumentFormat.Text) as TextDocumentOptions;
    options.Formatted = true;

    ocrEngine.DocumentWriterInstance.SetOptions(DocumentFormat.Text, options);

    document.Save(outputFilename, DocumentFormat.Text, null);
 }

 ocrEngine.Shutdown();
}

The toolkit is available for evaluation at http://www.leadtools.com

If you'd prefer something end-user ready, ePrint can also perform this conversion. https://eprintdriver.com/

(Note: I work for the company which creates these products.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.