Visual Basic (Declaration) | |
---|---|
Public Interface IOcrPage |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public interface IOcrPage |
C++/CLI | |
---|---|
public interface class IOcrPage |
This example creates an OCR document and adds a page to it, displays various information about the page and then saves it as PDF file.
Visual Basic | Copy Code |
---|---|
Public Sub OcrPageExample() |
C# | Copy Code |
---|---|
public void OcrPageExample() |
IOcrPage defines a page currently added in the OCR engine. Each page contains the raster image used to create it (the image used when the page is loaded or added) and a group of OCR zones for the page either added manually or through auto-zoning.
You can access the pages inside the OCR document (IOcrDocument) through the IOcrDocument.Pages property. The value of this property is a IOcrPageCollection interface. This interface implements standard .NET Generic ICollection, Generic IList, and Generic IEnumerable interfaces and hence, you can use the member of these interfaces to add, remove, get, set and iterate through the different pages of the document.
You cannot create IOcrPage objects directly. Instead, add pages to the engine through the various AddPage, AddPages, InsertPage and InsertPages methods of the IOcrPageCollection interface. Once a page is added, access it by index to get the IOcrPage object associated with it.
Each page contains a collection of OCR zones. This collection can be accessed with the Zones member. This member implements the IOcrZoneCollection interface which also implements the same standard .NET collections interfaces as IOcrPageCollection. Hence you can use Zones to add, remove, get, set and iterate through the various zones in the page.
After adding a page to an OCR document and optionally manipulating the zones inside it, call the IOcrPage.Recognize or RecognizeText methods to collect the recognition data of the page. This data is stored internally in the page and can later be saved to one of the many document file formats supported by the engine such as PDF or Microsoft Word.
After a page is recognized, examine and modify the recognition data (characters and words) through the GetRecognizedCharacters and SetRecognizedCharacters methods.
Once an IOcrPage object is obtained on a page, you can do the following:
Get information regarding the page image, such its Width, Height, BitsPerPixel and the DPI (DpiX and DpiY) values. Get a RasterImage object with the GetRasterImage method that represents the page raster image data. Manipulate this image with other parts of LEADTOOLS such as the various image processing commands or show it in the Windows Forms viewer. You can also use SetRasterImage to update the page raster image data.
Note, the LEADTOOLS Plus OCR engine does not support image sizes greater than A3 paper size (11.7 by 16.5 inches at 300 dpi). Attempting to add an image that has a size greater than A3 will result in an error. For larger documents, you must first resize the image before adding it to the LEADTOOLS Plus OCR engine. The Professional and Advantage engines do not have a restriction on the image size.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family