Article Preview
Buy Now
FEATURE
Windows OCR
Working with Windows' built-in OCR library
Issue: 21.3 (May/June 2023)
Author: Stefanie Juchmes
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 10,045
Starting Page Number: 47
Article Number: 21304
Related Link(s): None
Excerpt of article text...
Did you know that Windows 10 has a built-in OCR library? The MBS Xojo Plugins in version 23.1 gives you the possibility to use this built-in text recognition in your applications. We show you how this works in an example that comes with the plugin (see Figure 1). Let's take a closer look at this now.
When we open the Windows OCR example, we see a button at the top that we can use later to load an image file, two checkboxes for options that we will discuss later, and a button that we can use to clear the fields. Below is a
textArea
and next to it acanvas
object. In thetextArea
we show later the recognized text and in thecanvas
will be an image on which we draw the recognized text. At the moment we see in thetextArea
some information on whether your system is suitable for OCR recognition. You can see which languages are available for recognition, how big the maximum size of your image can be, and which language is currently set in your system. We query this information in theOpen
event of the window.First, we can check if the Windows OCR functions are available for the system with the method Available from the class
WindowsOCREngineMBS
. If we gettrue
back, we useAvailableRecognizerLanguages
to query the languages that are supported by the OCR. We get the languages as aWindowsOCRLanguageMBS
object array and can retrieve theDisplayName
andLanguageTag
properties for each element. These are then appended to the text that is written to thetextField
:
If WindowsOCREngineMBS.Available Then
Dim lines() As String
...End of Excerpt. Please purchase the magazine to read the full article.