Groupdocs.conversion for java 23.4 unusable

After converting a jpg to a pdf with groupdocs conversion 23.4, I try to print the pdf by using pdfbox (version 2.0.28).
During the print operation java checks which imageio services exist and the print opertaion throws the following exception:

12-5-23 11:00:29.461 [130] Error services: java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.aspose.note.internal.twelvemonkeys.imageio.plugins.tiff.TIFFImageReaderSpi not found
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:210)
	at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
	at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
	at javax.imageio.ImageIO.<clinit>(ImageIO.java:66)
	at org.apache.pdfbox.filter.Filter.findImageReader(Filter.java:151)
	at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:76)
	at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:87)
	at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
	at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:243)
	at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:901)
	at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:499)
	at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:226)
	at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:514)
	at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:477)
	at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1111)
	at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:67)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:966)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:541)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:516)
	at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155)
	at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:284)
	at org.apache.pdfbox.rendering.PDFRenderer.renderPageToGraphics(PDFRenderer.java:465)
	at org.apache.pdfbox.printing.PDFPrintable.print(PDFPrintable.java:264)
	at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:2165)
	at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1547)
	at com.xafax.eap.easyprint.wappl.services.UploadJobServlet$2.run(UploadJobServlet.java:1655)
	at java.lang.Thread.run(Thread.java:748)

In the groupdocs.conversion 23.4 jar file a reference to com.aspose.note.internal.twelvemonkeys.imageio.plugins.tiff.TIFFImageReaderSpi is made, but the com.aspose.note package is completely not available in that jar file.
This way the groupocs jar file 23.4 becomes unusable in combination with imageio operations.

1 Like

@ravitsec

Could you please share the sample code and the problematic Image file?

The sample code is not really possible to put here, as it is a very complex piece of threaded code in order to upload documents, convert them and then print them to a selected printer with all kinds of user set options.

The conversion of an image file to an pdf isn’t the problem, that works ok.
I even get the error when using some other pdf not generated via Groupdocs.conversion.

And also the usage of PDFBox is like the normal examples they offer.

But the problem comes when used together.
The Groupdocs.conversion 23.4 jar file has the following files in it:

\META-INF\services\javax.imageio.spi.ImageReaderSpi
\META-INF\services\javax.imageio.spi.ImageWriterSpi

Those two files contain classes which do not exist in the jar file, for example “com.aspose.note.internal.twelvemonkeys.imageio.plugins.tiff.TIFFImageReaderSpi”.
So when java is using imageio (during printing via PDFBox), it checks all the available imageio services in all the jar files in the classpath and finds these two above which create the exception because those classes in it do not exist.
All the other entries in the \META-INF\services have class entries which point to com.sun.media. classes.

In the previous version of Groupdocs.conversion (23.2) the two files above have com.sun.media. classes in it. That’s why PDFBox did not have any issues with that older version.
The problem is that those classes it points to do not exist. That should not be possible and there should be classnames in those files that do exist, either in the jar file itself, or in another jar file in the classpath (java itself or 3rd party).

1 Like

@ravitsec

Thanks for the details. We have logged this scenario in our internal issue tracking system. Your investigation ticket ID is CONVERSIONJAVA-1983. We’ll notify you in case of any update.

@ravitsec

This issue is resolved in API version 23.4.