import aspose.ocr as api from aspose.ocr import License # Instantiate and apply the license for Aspose.OCR to enable full functionality. license = License() license.set_license("License.lic") # Create an instance of the Aspose.Ocr class for OCR processing. extractTextFromReceipt = api.AsposeOcr() # Initialize an OcrInput object to hold input image(s) for OCR processing. receiptDatas = api.OcrInput(api.InputType.SINGLE_IMAGE) # Add images (receipts) to the OcrInput object for recognition. receiptDatas.add("Receipt1.png") receiptDatas.add("Receipt2.png") # Set up receipt recognition settings. recognitionSettings = api.ReceiptRecognitionSettings() recognitionSettings.language = api.Language.ENG # Specify the language as English. # Perform OCR to recognize text from the input receipts using the specified settings. results = extractTextFromReceipt.recognize_receipt(receiptDatas, recognitionSettings) # Get the number of recognized results (one result per input image). length = results.length # Loop through each result and print the recognized text for each input image. for i in range(length): print(results[i].recognition_text)