OCR Xpress for Linux
OCRX_get_utf8_text

Gets the text contained by a given result in UTF-8 format.

Arguments:

Name  Type  Description
result  const OCRX_Result  Result for which to get text.
textBuffer  char* Buffer in which to place the retrieved text.
textBufferSize  const int32_t  Size of the buffer.

Return Value:

OCRX_Status – Specifies whether an error occurred and, if so, specifies which error and any relevant details.

Example:

Copy Code
#include “ocrxpress.h”

intptr_t dib = 0;
OCRX_RecognitionParameters params = OCRX_DefaultRecognitionParameters;
OCRX_Result documentResult = 0;
char* textBuffer = 0;
int32_t textBufferSize = 0;

OCRX_set_solution_name(“solutionName”);
OCRX_set_solution_key(0x00000001, 0x00000002, 0x00000003, 0x00000004);
OCRX_set_oem_license_key(“oemLicenseKey”);

OCRX_load_file(“/home/user/image.bmp”, &dib);
OCRX_recognize_to_memory(params, dib, &documentResult);
OCRX_free_dib(dib);
OCRX_get_utf8_text_size(documentResult, &textBufferSize);
textBuffer = (char*)malloc(sizeof(char) * textBufferSize);
OCRX_get_utf8_text(documentResult, textBuffer, textBufferSize);
free(textBuffer);
OCRX_free_document_result(&documentResult);

 

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback