Browse our Products

Latest release

Deprecation warning

What was changed

KeySummaryCategory
OCRNET‑782Added the ability to extract essential details (such as a number, name, date of birth, and so on) from US passport images.New feature
OCRNET‑845Enabled embedding of user-specified fonts in recognition results saved as PDFs.New feature
OCRNET‑782Aspose.OCR.Country.UNIVERSAL recognition parameter that disables extraction of key details from passport images is replaced with Aspose.OCR.Country.NONE.Enhancement

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for .NET 24.6.0 that June affect the code of existing applications.

Added public APIs:

No changes.

Updated public APIs:

The following public APIs have been changed in Aspose.OCR for .NET 24.6.0 release:

Aspose.OCR.Country enumeration

The following values have been added to Aspose.OCR.Country enumeration:

ValueCountry
Aspose.OCR.Country.NONEDo not parse passport details (only recognize passport text).
Aspose.OCR.Country.USAExtract key details from US passport images.

RecognitionResult.Save() method

Added an optional embeddedFontPath parameter, which allows to embed a custom TrueType (.TTF) or OpenType (.OTF) font into the recognition result saved as a PDF document.

AsposeOcr.SaveMultipageDocument() method

Added an optional embeddedFontPath parameter, which allows to embed a custom TrueType (.TTF) or OpenType (.OTF) font into the recognition result saved as a PDF document.

Removed public APIs:

The following public APIs have been deprecated in Aspose.OCR for .NET 24.6.0 release:

Aspose.OCR.Country.UNIVERSAL enumeration value

This value is replaced with Aspose.OCR.Country.NONE. The original value is still supported, but marked as deprecated and will be removed in the version 25.1.0 of the library. Make sure to update your code to avoid errors.

Examples

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

Extract details from US passport image

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add scanned passport to recognition batch
OcrInput passports = new OcrInput(InputType.SingleImage);
passports.Add("us_passport_sample.png");
// Explicitly specify that you are processing US passport
var recognitionSettings = new PassportRecognitionSettings();
recognitionSettings.Country = Aspose.OCR.Country.USA;
// Recognize passport
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.RecognizePassport(passports, recognitionSettings);
// Parse passport data and output essential details along with image regions they were found in
var details = results[0].GetKeywords();
foreach (var item in details)
{
	Console.WriteLine($"{item.Key}: {item.Value.TextInLine}");
	Console.WriteLine($"Left: {item.Value.Line.X}; top: {item.Value.Line.Y}; size: {item.Value.Line.Width} x {item.Value.Line.Height}");
}

Embed custom font into saved PDF

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add images to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("page1.png");
input.Add("page2.png");
// Recognize images
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input);
// Save results as text-only PDF in Adobe Ming font
Aspose.OCR.AsposeOcr.SaveMultipageDocument("result.pdf", Aspose.OCR.SaveFormat.PdfNoImg, results, "fonts/AdobeMingStd-Light.otf");