Updates the page bitmap data from a BITMAPHANDLE object.


#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrPage_SetBitmap(page, bitmapHandle, freeOriginalBitmap)


L_OcrPage page

Handle to the OCR page.

BITMAPHANDLE* bitmapHandle

A BITMAPHANDLE that contains the image data that will be copied into this L_OcrPage.

L_BOOL freeOriginalBitmap

An option to determine whether to free the current page bitmap handle.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


Once you create an OCR page, the bitmap data used to create the page is copied and stored inside the page. To get the bitmap handle that represents this page, use L_OcrPage_GetBitmap.

The bitmap handle object that the L_OcrPage_GetBitmap method returns contains a copy of the page image data in case you choose to get the processing bitmap. Any modifications you make to the bitmap handle will not affect the page. To update the page image data, you must call L_OcrPage_SetBitmap. Since the BITMAPHANDLE object is a copy in case you got the processing bitmap, you must free it by calling L_FreeBitmap method once you are done using it. But this does not apply to getting the original bitmap from the page, you can't free that bitmap handle if you choose the L_OcrBitmapSharingMode_AutoFree option when you created that page.

Once you obtain a BITMAPHANDLE object for this page, you can use it with other parts of LEADTOOLS, for example, you can use it to draw the bitmap inside your viewer window. You can also perform your own image processing on the page by getting the page bitmap first using L_OcrPage_GetBitmap, apply some image processing operations on that bitmap like flipping it for example using L_FlipBitmap and then set it back to the page using L_OcrPage_SetBitmap.

Required DLLs and Libraries

See Also




For an example, refer to L_OcrPage_GetDeskewAngle

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.


Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.