Browse our Products

Aspose.OCR for C++ 23.8.0 - Release Notes

Deprecation warning

What was changed

KeySummaryCategory
OCRCPP‑486Multithreading support.New feature
OCRCPP‑487Providing PNG and JPEG images as byte arrays.New feature
OCRCPP‑488Providing ZIP archives as byte arrays.New feature

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for C++ 23.8.0 that may affect the code of existing applications.

Added public APIs:

The following public APIs have been introduced in this release:

asposeocr_set_allowed_thread_number() function

Set the number of threads used by the recognition engine. If you specify 1, recognition will be performed on the application’s main thread.

By default, the recognition runs on the application’s main thread.

asposeocr_get_allowed_thread_number() function

Return the number of threads used by the recognition engine.

AsposeOCRRawDataType.ASPOSE_OCR_FORMAT_PNG enumeration

Allows to provide a PNG image as a byte array (unsigned char*).

AsposeOCRRawDataType.ASPOSE_OCR_FORMAT_JPG enumeration

Allows to provide a JPEG image as a byte array (unsigned char*).

AsposeOCRRawDataType.ASPOSE_OCR_FORMAT_ZIP enumeration

Allows to provide a ZIP archive as a byte array (unsigned char*).

Updated public APIs:

No changes.

Removed public APIs:

No changes.

Usage examples

The examples below illustrates the changes introduced in this release:

Multithreading support

// Use 8 threads for OCR
asposeocr_set_allowed_thread_number(8);
// Provide images
string file = "page1.png";
AsposeOCRInput source1;
source1.url = file.c_str();
string file = "page2.png";
AsposeOCRInput source2;
source2.url = file.c_str();
std::vector<AsposeOCRInput> content = { source1, source2 };
// Fine-tune recognition
RecognitionSettings settings;
settings.language_alphabet = language::ukr;
// Extract text from the image
auto result = asposeocr_recognize(content.data(), content.size(), settings);
// Output the recognized text
wchar_t* buffer = asposeocr_serialize_result(result, buffer_size, export_format::text);
std::wcout << std::wstring(buffer) << std::endl;
// Release the resources
asposeocr_free_result(result);

Provide PNG image as a byte array

// Provide PNG image
AsposeOCRInput input;
input.raw_data_type = ASPOSE_OCR_FORMAT_PNG;
const unsigned char* png_img_buff = <PNG image as byte array>;
size_t png_img_buff_size = <length of image byte array>;
input.raw_data = png_img_buff;
input.raw_data_size = png_img_buff_size;
std::vector<AsposeOCRInput> images{ input };
// Fine-tune recognition
RecognitionSettings settings;
settings.language_alphabet = language::ukr;
// Extract text from the image
auto result = asposeocr_recognize(content.data(), content.size(), settings);
// Output the recognized text
wchar_t* buffer = asposeocr_serialize_result(result, buffer_size, export_format::text);
std::wcout << std::wstring(buffer) << std::endl;
// Release the resources
asposeocr_free_result(result);