Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, November 20, 2017 2:39:19 PM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 368

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

This Visual Studio 2017 console project uses LEADTOOLS v20 Leadtools.Ocr.NETStandard nuget package to illustrate the minimum code required to OCR single page or multi-page files and save it as a plain text (TXT), Portable Document Format (PDF), or LEAD Temporary Document file (LTD).

The demo uses command line arguments to set the input file, output file, and output document type. Here are example argument lists:
-i "C:\Users\Public\Documents\LEADTOOLS Images\Leadtools.pdf" -o "D:\junk folder\Leadtools.pdf.txt" -f TXT
-i "C:\Users\Public\Documents\LEADTOOLS Images\OCR1.TIF" -o "C:\OCR1.pdf" -f PDF

ApplicationArguments.PNG


The core OCR code can be summed up in a few lines:
Code:

codecs.Options.Load.AllPages = true;
image = codecs.Load(inputFile);

ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false);
ocrEngine.Startup(codecs, null, null, OCR_ENGINE_PATH);

ocrDocument = ocrEngine.DocumentManager.CreateDocument();
ocrDocument.Pages.AddPages(image, 1, image.PageCount, null);
foreach (Leadtools.Ocr.IOcrPage page in ocrDocument.Pages)
   page.Recognize(null);
            
ocrDocument.Save(outputFile, format, null);
File Attachment(s):
CS_CoreStd_SimpleOCR.zip (16kb) downloaded 145 time(s).


Before running this demo, please verify the DEVELOPER_LIC and DEVELOPER_KEY file paths exist and change the application arguments if desired.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2018, Yet Another Forum.NET
This page was generated in 0.128 seconds.