Aspose OCR integration

Hello Team, I am trying to implement OCR functionality in mendix  and My use case is when I upload a image and click the button then it has to extract all the text present on the image. So, I am going with Aspose Api where they will provide java libraries and with that, we have to use java to write code to extract text. But this is my first time to work with java actions and on integrating part. So, need guidance to proceed further. Any Suggestions would be appreciated.   Thanks In advance,
1 answers

You will need to pass the filedocument as argument to the java action.

Then extract the content from the file (look at the Core class for this, see,com.mendix.systemwideinterfaces.core.IMendixObject)) and follow something like the code below where you'll need a inputstream for the extracted content to write this to a new filedocument.

Hope this gives you some idea on how to proceed.


// Create an instance of AsposeOcr class to apply OCR on an image
AsposeOCR TextExtractFromImage = new AsposeOCR();

// Read image using RecognizePage method for text extraction
String ExtractedTextFromImage = TextExtractFromImage.RecognizePage("ExampleOCRImageToExtractText.jpg");

// Save extracted text to a text file using FileWriter
File output = new File("TextExtractFromImageUsingOCR.txt");
FileWriter writer = new FileWriter(output);