Details
Description
I have the following test:
@Test
public void testPDFBoxBug() throws IOException
private List<String> convertPDFToPNGLight(byte[] input) throws IOException {
List<String> convertedPNGs = new ArrayList<>();
PDDocument doc = PDDocument.load(input);
PDFRenderer renderer = new PDFRenderer(doc);
for(int i = 0; i < doc.getNumberOfPages() ; i++) {
BufferedImage img = null;
img = renderer.renderImageWithDPI(i, 96);
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
ImageIO.write(img, "PNG", out2);
out2.size();
convertedPNGs.add(Base64Utils.encodeToString(out2.toByteArray()));
try (OutputStream outputStream = new FileOutputStream("target/thefilename" + i + ".png"))
}
doc.close();
return convertedPNGs;
}
My input and output are in attachment.
Attachments
Attachments
Issue Links
- duplicates
-
PDFBOX-1752 Rendering PDF containing Jpeg2000 fails
- Closed