I am currently evaluating Aspose for document conversion. I found one interesting case where a PDF conversion to PNG outputs an empty image file. Out of curiosity, I tried using a JPG conversion versus a PNG conversion and the JPG is also blank. The code to do the conversion is very simple:
try (InputStream is = new ByteArrayInputStream(bytes)) {
Document document = new Document(is);
if (document.getPages().size() > 0) {
try {
Resolution resolution = new Resolution(300);
PngDevice pngDevice = new PngDevice(resolution);
byte[] imageBytes = null;
// Make thumbnail image
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
pngDevice.process(document.getPages().get_Item(1), baos);
imageBytes = baos.toByteArray();
}
}
}
}
Is there something I am missing? Please see the attached PDF and the empty PNG that is created.
april.png (39.8 KB)
april-dagonese1.pdf (784.1 KB)