Hi,

This is very mysterious. There are similar errors here, it seems to be jdk related:
https://github.com/haraldk/TwelveMonkeys/issues/201
https://github.com/haraldk/TwelveMonkeys/issues/357

Make sure you have a current jdk version, e.g. the last publicly available jdk8 version, or jdk12.

Also test without pdfbox, i.e. just try setting up a project with

ImageIO.getImageReadersByFormatName("JPEG2000");

and see what happens.

Re mailing list: make sure you're subscribed. If you can't subscribe, please tell what you did.

Tilman

Am 17.07.2019 um 13:18 schrieb Prakash Sabapathy:
Hi Tilman,

For reasons unknown I can only see your response under markmail.org. A copy of 
it can be found below.

I commented out the test scope (i.e. <!-- <scope>test</scope> -->) under the 
dependency with groupId com.github.jai-imageio for artifactId jai-imageio-core and 
jai-imageio-jpeg2000 in pom.xml files in the following directories:

debugger
parent
pdfbox
tools

This was using the source code in pdfbox-2.0.16-src.zip.

When I run java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -jar 
app/target/pdfbox-app-2.0.16.jar PDFToImage testwithimages.pdf, the error 
message I receive is:

Jul 17, 2019 8:37:08 PM org.apache.pdfbox.pdmodel.font.PDTrueTypeFont <init>
WARNING: Using fallback font 'LiberationSans' for 'TimesNewRomanPSMT'
Exception in thread "main" java.util.ServiceConfigurationError: 
javax.imageio.spi.ImageWriterSpi: Provider 
com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi 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.JPXFilter.readJPX(JPXFilter.java:115)
         at org.apache.pdfbox.filter.JPXFilter.decode(JPXFilter.java:64)
         at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:84)
         at 
org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
         at 
org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:163)
         at 
org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:236)
         at 
org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.<init>(PDImageXObject.java:140)
         at 
org.apache.pdfbox.pdmodel.graphics.PDXObject.createXObject(PDXObject.java:70)
         at 
org.apache.pdfbox.pdmodel.PDResources.getXObject(PDResources.java:426)
         at 
org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:54)
         at 
org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
         at 
org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
         at 
org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
         at 
org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
         at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:263)
         at 
org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:321)
         at 
org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243)
         at 
org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229)
         at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:250)
         at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:89)

The IDE is Visual Studio Code running in Windows 10 however the source code and 
Java compiler etc (Oracle Java 8) are in Linux (Debian stretch) virtual machine 
(VirtualBox). I compiled the source code with mvn clean install from a console 
in the virtual machine and also executed it in the same console.

Regards
Prakash

Hi,


No java source code change is needed.


How does your pom.xml look?


What IDE are you using?


Please post the full stack trace. I'm surprised that the log mentions
"com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi" but at the same
time claims that the JAI tools are not installed. But
"com.github.jaiimageio.jpeg2000" is the package of the tool on github.


Tilman


Am 16.07.2019 um 14:48 schrieb Prakash Sabapathy:

Hi,


Are there any simple instructions for a novice in Java on how to suitably change
the source code of PDFBox to allow it to read PDF documents with images in
JPEG2000 format?


I've tried to change pom.xml under various directories (trial and error) and I
keep getting either of the following errors:


Exception in thread "main" java.util.ServiceConfigurationError:
javax.imageio.spi.ImageWriterSpi: Provider
com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi not found


or


SEVERE: Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools
are not installed


Regards
Prakash


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to