Browse our Products

Latest Release

Deprecation warning

What was changed

KeySummaryCategory
OCRPY‑70Automatic extraction of key details (such as a number, birth date, and the like) from US passport images.New feature
OCRPY‑70Embedding of user-specified fonts in recognition results saved as PDFs.New feature
OCRPY‑70Country.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 Python via .NET 24.6.0 that may affect the code of existing applications.

Added public APIs:

Keyword class

An object representing a single passport detail as a name-value pair:

  • key - passport detail ID, for example DATE_OF_BIRTH;
  • value - specific passport detail, for example 1 Sep 2000

Updated public APIs:

The following public APIs have been introduced in this release:

Aspose.OCR.Country enumeration

The following values have been added to Country enumeration:

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

save.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.

save_multipage_document() 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:

Country.UNIVERSAL enumeration value

This value is replaced with 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

# Instantiate Aspose.OCR API
api = ocr.AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("us_passport.png")
# Enable US passport recognition
settings = ocr.PassportRecognitionSettings()
settings.country = ocr.Country.USA
# Extract passport details
result = api.recognize_passport(input, settings)
details = result[0].get_keywords()
for detail in details:
    print(detail.key)
    print(detail.value.text_in_line)

Embed custom font into saved PDF

# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.PDF)
input.add("source.pdf")
# Recognize the image
results = api.recognize(input)
# Save recognition result
save_multipage_document("result.pdf", SaveFormat.PDF_NO_IMG, results, "fonts/AdobeMingStd-Light.otf")