Extracting text from invoices
Contents
[
Hide
]
Even a small business may deal with dozens of printed invoices per day. Manual re-typing is time consuming and error-prone, and even a single mistake may result in significant losses.
Aspose.OCR for Python via .NET offers a special recognition algorithm that extracts text from scanned invoices, which can then be automatically sent to accounting programs, databases or banks.
To extract text from an invoice, use recognize_invoice()
method of AsposeOcr
class.
This method allows you to customize recognition accuracy, performance, and other settings.
The method takes OcrInput
object and returns a RecognitionResult
object containing the invoice data.
# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("invoice1.png")
input.add("invoice2.png")
# Set recognition language
recognitionSettings = InvoiceRecognitionSettings()
recognitionSettings.Language = Aspose.OCR.Language.Latin;
# Recognize invoices
results = api.recognize_invoice(input, recognitionSettings)
# Print recognition result
for result in results:
print(result.recognition_text)