I have an Java/Gradle application that uses PDFBox to convert PDFs to PNGs. While testing locally on my IDE, my code is as follows:
public static void main(String[] args) throws IOException {
PDDocument doc = PDDocument.load(new File("pdfFile.pdf"));
PDFRenderer renderer = new PDFRenderer(doc);
OutputStream os = new FileOutputStream(new File("image.png"));
ImageIO.write(renderer.renderImageWithDPI(0, 300), "png", os);
}
In prod, another application launches a new JVM that runs my application. I'm not sure what the classpath for the parent application is, but if I have the following in my Gradle dependencies, does it matter?
implementation "org.apache.pdfbox:jbig2-imageio:3.0.2"
While testing my main method locally on my IDE, it works fine but not using the second setup I described. I have also checked my manifest and can see the following files:
META-INF/services/javax.imageio.spi.ImageReaderSpi
META-INF/services/javax.imageio.spi.ImageWriterSpi
What am I missing?