I am working with Aspose PDF 16.12.0. When converting from PDF to PNG, there are strange image artifacts present on the converted document. The pdf which had the issue is attached, as are ‘before’ and ‘after’ screenshots of the conversion.
The code is intended to convert a specific page in a pdf document to a png image. There is a field “document” of type com.aspose.pdf.Document in the class that holds the pdf document and is set prior to this method being called.
The code used is as follows (slightly modified to remove irrelevant details):
public void createPage(final int pageNumber) {(Edit 22/03/17: edited to attache the pdf.)
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final Resolution resolution = new Resolution(80);
PngDevice pngDevice = new PngDevice(resolution);
pngDevice.process(document.getPages().get_Item(pageNumber), outputStream);
//image is extracted from outputStream and returned
}