Browse our Products

Aspose.OCR for Java 24.12.0 - Release Notes

Deprecation warning

What was changed

KeySummaryCategory
OCRNET‑407Added a container class for storing recognition results.New feature
OCRNET‑407Added support for recognizing Mongolian texts.New feature
OCRNET‑407Added a method to release memory by unloading unneeded OCR modules.New feature
OCRNET‑407Significantly enhanced the performance of saving recognition results to searchable PDFs.Enhancement
OCRNET‑407Improved the calculation of line height in searchable PDFs.Enhancement

Public API changes and backwards compatibility

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

Added public APIs:

The following public APIs have been added to Aspose.OCR for Java 24.12.0 release:

OcrOutput class

A container class that stores recognition results, which is returned from all recognition methods instead of a collection of RecognitionResult objects.

It is fully backward compatible with the ArrayList<RecognitionResult>, which means you do not have to update your existing code.

Resources.ReleaseMemory()

Unload all OCR modules to free up memory. The downloaded module files will remain stored on your system.

If you need to use the OCR module again later, it will automatically reload into memory. Please note that the first recognition attempt may be slightly slower due to the reloading process.

Updated public APIs:

The following public APIs have been updated in Aspose.OCR for Java 24.12.0 release:

Language

Aspose.OCR for Java can now extract texts in the following languages:

ValueAlphabet
Language.MonMongolian texts.

AsposeOcr.Recognize()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeHandwrittenText()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeReceipt()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeInvoice()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeIDCard()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeCarPlate()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizePassport()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

AsposeOcr.RecognizeLines()

This method now returns an optimized container object, OcrOutput. The return type is fully compatible with the previously returned collection of RecognitionResult objects, so no code updates are necessary at the moment.

Removed public APIs:

No changes.

Examples

The code samples below illustrate the changes introduced in this release:

Mongolian text recognition

AsposeOCR api = new AsposeOCR();
RecognitionSettings recognitionSettings = new RecognitionSettings();
// Recognize Mongolian text
recognitionSettings.setLanguage(Language.Mon);
RecognitionResult result = api.RecognizePage("source.png", recognitionSettings);
System.out.println("Recognition result:\n" + result.recognitionText + "\n\n");

Unload OCR models from memory

// Download Hindi OCR model to "aspose/ocr" directory in the application working directory
Resources.SetLocalPath("aspose/ocr");
Resources.FetchResource("aspose-ocr-hindi-v1");
// Initialize Aspose.OCR recognition API
AsposeOCR api = new AsposeOCR();
RecognitionSettings recognitionSettings = new RecognitionSettings();
// Add image to the recognition batch
OcrInput source = new OcrInput(InputType.SingleImage);
source.add("image.png");
// Extract text from image
RecognitionSettings recognitionSettings = new RecognitionSettings();
recognitionSettings.setLanguage(Language.Hin);
ArrayList<RecognitionResult> results = api.Recognize(source, recognitionSettings);
System.out.println(result[0].recognition_text);
// Unload recognition modules from memory
Resources.ReleaseMemory();