OCR Xpress for Linux - Updated
OCRX_recognize_to_file_and_memory
API Reference > OCR Xpress for Linux API Reference > Functions Reference > Recognition Functions > OCRX_recognize_to_file_and_memory

Recognizes an image and outputs the result to file and an in-memory structure.

If the output file already exists and was created by OCR Xpress for Linux, it will be appended. Otherwise, it will be created or overwritten.

Arguments:

Name  Type  Description
params  const OCRX_RecognitionParameters  Parameters with which to perform recognition.
dib  const intptr_t  Image on which to perform recognition.
format  const OCRX_FileFormat  File format to output.
mode const OCRX_FileMode File mode for the output.
filePath  const char*  Output file path.
documentResult  OCRX_Result*  Document result from recognition.

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;

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_file_and_memory(params, dib, OCRX_FileFormat_PDF, OCRX_FileMode_Overwrite, “/home/user/image.pdf”, &documentResult);
OCRX_free_dib(dib);
OCRX_free_document_result(&documentResult);