Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created January 26, 2022 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/55d48e68f63e416b1c7882a7c832758e to your computer and use it in GitHub Desktop.
Save aspose-com-gists/55d48e68f63e416b1c7882a7c832758e to your computer and use it in GitHub Desktop.
Convert Image to Excel with OCR in Java
//Create api instance
AsposeOCR api = new AsposeOCR();
try {
RecognitionSettings settings = new RecognitionSettings();
RecognitionResult result = api.RecognizePage("OCR.png", settings);
// Save OCR results as XLSX Excel file
result.save("OCRjava.xlsx", Format.Xlsx);
} catch (IOException e) {
e.printStackTrace();
}
// Get image for recognize
String uri = "https://qph.fs.quoracdn.net/main-qimg-0ff82d0dc3543dcd3b06028f5476c2e4";
//Create api instance
AsposeOCR api = new AsposeOCR();
try {
RecognitionSettings set = new RecognitionSettings();
RecognitionResult result = api.RecognizePageFromUri(uri, set);
// Save OCR results as XLSX Excel file
result.save("OCRjava.xlsx", Format.Xlsx);
} catch (IOException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment