i want to extract the first Page of a PDF-File as an Image. With the following lines it works just fine:
PDDocument doc = PDDocument.load(pdf);
PDFRenderer pdfRenderer = new PDFRenderer(doc);
BufferedImage img = pdfRenderer.renderImageWithDPI(0, 72, ImageType.ARGB);
BUT, if the PDF-File contains a jpeg2000 Image on this Page, i get the following Error in my logfile "Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools are not installed"
Google told me i can use these Dependencys to fix it
- jai-imageio-core
- jai-imageio-jpeg2000
but since its unclear if its allowed to use this in a regular Application i dont want to use them.
So my real Question is:
Is there a way to check if there's a jpeg2000 on this page?
Im using pdfbox-Version: 2.0.19