LEADTOOLS Support
Document
Document SDK FAQ
Can I extract text from my screen using your OCR?
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
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)
{
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
{
ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLeadRuntimeDir);
using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument())
{
IOcrPage ocrPage = ocrDocument.Pages.AddPage(e.Image, null);
ocrPage.AutoZone(null);
ocrPage.Recognize(null);
ocrDocument.Save(pdfFileName, DocumentFormat.Pdf, null);
}
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/sdk/dh/sc/screencaptureengine.htmlhttps://www.leadtools.com/help/sdk/dh/fo/iocrengine.htmlFurthermore, 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/Edited by moderator about a year ago
| Reason: Updated
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.

LEADTOOLS Support
Document
Document SDK FAQ
Can I extract text from my screen using your OCR?
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.