Learn how to implement OCR invoice scanning using Python, C#, and Java.
Created
August 7, 2024 16:59
OCR Invoice Scanning in C#, Python, and Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code example demonstrates how to read and extract information from an invoice in C#. | |
using Aspose.OCR; | |
// Initialize an instance of AsposeOcr | |
Aspose.OCR.AsposeOcr api = new Aspose.OCR.AsposeOcr(); | |
OcrInput images = new OcrInput(InputType.SingleImage) | |
{ | |
"invoice.jpg" | |
}; | |
// Recognize invoice screenshot image with OCR | |
var result = api.RecognizeInvoice(images); | |
// Display the recognized text from invoice | |
foreach (var image in result) | |
{ | |
Console.WriteLine(image.RecognitionText); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to read and extract information from an invoice using Java. | |
import com.aspose.ocr.*; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
// The image path | |
String imagePath = "handwritten.jpg"; | |
//Create api instance | |
AsposeOCR api = new AsposeOCR(); | |
// Create OcrInput object and add images/documents for recognition | |
OcrInput input = new OcrInput(InputType.SingleImage); | |
input.add(imagePath); | |
ArrayList<RecognitionResult> result = api.RecognizeInvoice(input, null); | |
System.out.println(result.get(0).recognitionText); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to read and extract information from an invoice in Python. | |
import aspose.ocr as ocr | |
# Initialize OCR engine | |
api = ocr.AsposeOcr() | |
# Add image to the recognition batch | |
input = ocr.OcrInput(ocr.InputType.SINGLE_IMAGE) | |
input.add("D:\Files\invoice.jpg") | |
# Recognize the image | |
result = api.recognize_invoice(input) | |
# Print recognition result | |
print(result[0].recognition_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment