Destroys the created L_OcrPage handle.
#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_Destroy(page)
Handle to the OCR page to destroy.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Destroys the created L_OcrPage handle and free all its resources.
L_OcrPage defines a page currently added in the OCR engine. Each page contains the bitmap handle used to create it (the bitmap used when the page is created) and a group of OCR zones for the page either added manually or through auto-zoning.
Pages can be stand-alone or part of an L_OcrDocument. To create a stand-alone page, use L_OcrPage_FromBitmap.
For information on how to create memory-based or file-based documents or how to load file-based documents from disk refer to L_OcrDocumentManager_CreateDocument and Programming with LEADTOOLS OCR Module - LEAD Engine.
You can access the pages inside a memory-based OCR document (L_OcrDocument) through some methods like L_OcrDocument_AddPage, L_OcrDocument_GetPage, and some other functions.
Pages inside memory-based document do not need to be destroyed. The owner L_OcrDocument will automatically destroy the pages when it is destroyed.
Usually, you create a page directly using L_OcrPage_FromBitmap. You can use all the L_OcrPage methods to zone and recognize the OCR page as listed below as usual. And if saving the page to a final output format is required, then you can only add this page to a file-based L_OcrDocument using L_OcrDocument_AddPage method since L_OcrDocument_InsertPage is not supported in file-based documents.
Pages that were added to the file-based documents must be destroyed by the user using L_OcrPage_Destroy since the file-based document does not own these page, it just takes a snapshot of these pages so its the user responsibility to destroy the original created pages.
Each page contains a list of OCR zones. This list can be accessed with some L_OcrPage supported methods that deal with zones like L_OcrPage_AddZone, L_OcrPage_InsertZone, L_OcrPage_GetZoneAt and list of other methods.
After optionally manipulating the zones inside a page, call L_OcrPage_Recognize 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 L_OcrPage_GetRecognizedCharacters and L_OcrPage_SetRecognizedCharacters methods. The L_OcrPage_GetText method can be used to obtain the recognition data as simple string object.
Once an L_OcrPage handle is obtained, you can do the following:
For an example, refer to L_OcrPage_FromBitmap