Free Support Forum -

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

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)
at com.aspose.ocr.OcrEngine.a(Unknown Source)
at com.aspose.ocr.OcrEngine.process(Unknown Source)
at com.macroproyectos.ecm.ocr.OCRManager.performOcr(
at com.macroproyectos.ecm.ocr.OCRManager.main(
Caused by: java.lang.NullPointerException
at Source)
at Source)
at Source)
at Source)
… 4 more

This is a fragment of my code:“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);

InputStream in = this.getClass().getResourceAsStream(”/”);

String ocrText = null;

if (engine.process()) {
ocrText = engine.getText().toString();
}"OCR Terminado … ");

“” 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.