We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Fault when converting from PDF to PNG

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) {
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
}
(Edit 22/03/17: edited to attache the pdf.)

Hello David,


Thanks for using our API’s.

You have missed attaching the sample PDF document. Please attach the sample PDF document.

We are sorry for the inconvenience.

Best Regards,

My apologies; the pdf has been attached to the first post.

Hi David.


Thanks for sharing further details.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

I have tested the scenario and have managed to reproduce the problem that conversion from PDF to PNG results wrong png file for the second page. For the sake of correction, I have logged it as PDFJAVA-36622 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time.


We are sorry for this inconvenience.


Best Regards,