Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 21.3 ('London 2023')
Instant purchase and download via GumRoad!

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 a canvas object. In the textArea we show later the recognized text and in the canvas will be an image on which we draw the recognized text. At the moment we see in the textArea 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 the Open 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 get true back, we use AvailableRecognizerLanguages to query the languages that are supported by the OCR. We get the languages as a WindowsOCRLanguageMBS object array and can retrieve the DisplayName and LanguageTag properties for each element. These are then appended to the text that is written to the textField:

If WindowsOCREngineMBS.Available Then

Dim lines() As String

...End of Excerpt. Please purchase the magazine to read the full article.