PdfDecoder.setFontReplacements(decodePdf);
decodePdf.useHiResScreenDisplay(true);
decodePdf.getDPIFactory().setDpi(2 * 72);
decodePdf.setPageParameters(1, 1);
try {
decodePdf.openPdfArray(baos.toByteArray());
/** get page 1 as an image */
BufferedImage img = decodePdf.getPageAsImage(1);
/** close the pdf file */
decodePdf.closePdfFile();