Free Support Forum - aspose.com

OCR 17.2 process throws NullPointerException with SPA language pack

I’m trying to process an image and i’m loading the spanish pack available in


https://downloads.aspose.com/ocr/net/resources/spanish-language-resource-file-for-aspose.ocr-for-.net-3.2.0/

When i’m executing the OCR process throws a NullPointerException, this is the stacktrace:

Exception in thread “main” class com.aspose.ocr.OcrException: Error occurred during recognition. —> java.lang.NullPointerException
— End of inner exception stack trace —
com.aspose.ocr.OcrEngine.a(Unknown Source)
com.aspose.ocr.OcrEngine.process(Unknown Source)
com.macroproyectos.ecm.ocr.OCRManager.performOcr(OCRManager.java:85)
com.macroproyectos.ecm.ocr.OCRManager.main(OCRManager.java:110)
at com.aspose.ocr.OcrEngine.a(Unknown Source)
at com.aspose.ocr.OcrEngine.process(Unknown Source)
at com.macroproyectos.ecm.ocr.OCRManager.performOcr(OCRManager.java:85)
at com.macroproyectos.ecm.ocr.OCRManager.main(OCRManager.java:110)
Caused by: java.lang.NullPointerException
at com.aspose.ocr.internal.aw.a(Unknown Source)
at com.aspose.ocr.internal.al.a(Unknown Source)
at com.aspose.ocr.internal.al.a(Unknown Source)
at com.aspose.ocr.internal.al.a(Unknown Source)
… 4 more

This is a fragment of my code:

ECMLogger.mainLogger.info(“Iniciando OCR … “);
OcrEngine engine = new OcrEngine();

Integer imageFormat = extensions.get(mimeType);
if (imageFormat == null) {
ECMLogger.mainLogger.error(“El tipo " + mimeType + " no es soportado”);
throw new RepositoryException(27);
}

IImageStream imgStream = ImageStream.fromStream(new ByteArrayInputStream(img), imageFormat);
engine.setImage(imgStream);

engine.getLanguageContainer().clear();
InputStream in = this.getClass().getResourceAsStream(”/spa.zip”);
engine.getLanguageContainer().addLanguage(LanguageFactory.load(in));

String ocrText = null;

if (engine.process()) {
ocrText = engine.getText().toString();
}

ECMLogger.mainLogger.info("OCR Terminado … ");

“spa.zip” is the language pack and it’s located in the root of the sources.
I’m attaching the source image .

Thanks for your attention
Hi Carlos,

Thank you for your inquiry and sharing sample.

This is to update you that we have investigated the issue at our end. Initial investigation shows that the issue persists. The issue has been logged into our system with ID OCRJAVA-749. Our product team will further look into it and provide feedback. We will update you with the feedback in this thread once available.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.