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 : Friday, April 7, 2017 4:01:44 PM(UTC)

Nick  
Nick

Groups: Registered, Tech Support, Administrators
Posts: 42


It is possible to do this using LEADTOOLS, by using the Multimedia Screen Capture filter in conjunction with LEADTOOLS OCR. Once the screen capture is made, an event is raised which contains a RasterImage containing the current screen contents. This information can then be passed to the OcrEngine and recognized accordingly.

Here's how this can be done by wiring in the OCR engine to process a screenshot raised from the event and save it to disk.

Code:

void scEngine_CaptureInformation(object sender, ScreenCaptureInformationEventArgs e) 
{ 
   // Define codecs class object to save the image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false)) 
   { 
      // Start the engine using default parameters 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrAdvantageRuntimeDir); 

      // Create an OCR document 
      using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument()) 
      { 
         // Add a page to the document 
         IOcrPage ocrPage = ocrDocument.Pages.AddPage(e.Image, null); 
 
         ocrPage.AutoZone(null); 
         ocrPage.Recognize(null); 
 
         // Save the document we have as PDF 
         ocrDocument.Save(pdfFileName, DocumentFormat.Pdf, null); 
      } 
 
      // Shutdown the engine 
      // Note: calling Dispose will also automatically shutdown the engine if it has been started 
      ocrEngine.Shutdown(); 
   }    
 
}


For more information on creating, configuring and using the screenshot engine, and about OCR, see our documentation pages.
https://www.leadtools.com/help/leadtools/v19m/dh/sc/screencaptureengine.html
https://www.leadtools.com/help/leadtools/v19m/dh/fo/iocrengine.html

Furthermore, we have a demo application which showcases this functionality created by a LEADTOOLS support agent. More information as well as source code is available on its info page.
https://www.leadtools.com/blog/document-imaging/ocr/ocr-screen-capture-25-projects-25-days/
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
nick@leadtools.com
www.LEADTOOLS.com
 

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-2017, Yet Another Forum.NET
This page was generated in 0.116 seconds.