Disable dithering when converting PDF to image?

I am using Aspose.Pdf for .NET, version 10.7.


Is it possible to completely disable dithering when converting a PDF page to an image?

We are using Aspose.Pdf to convert a page of a PDF to a PNG image, and then making that PNG image transparent. The image is then laid atop a background.

The dithering around the borders of the text in the PDF page make the text look blurry when overlaid on a different color background, so I was wondering if it would be possible to disable dithering when converting the PDF to an image.

Thanks

Hi Scott,


Thanks for contacting support.

Can you please share your sample PDF file, so that we can test the scenario in our environment. We are sorry for this inconvenience.

This happens when converting any PDF to PNG. CourseOutline.pdf is the PDF being converted into an image.


The file ConvertedPDF.png is the result of using Aspose.Pdf to convert the attached PDF into a PNG. If you zoom in on the text you can see that it is dithered.

The challenge I am facing is that when I save the PNG I have to lay it over a background color selected by the user. So I make the PNG transparent via the white color and lay it atop a colored image, but because of the gray pixels created by the dithering it looks like noise on top of the pink background.

So my thought is that if dithering didn’t happen when saving the PDF to an image it would look ok on a colored background.

Hi Scott,


Thanks for your patience.

I have tested the scenario using Aspose.Pdf for .NET 11.1.0 and I am unable to notice any issue. For your reference, I have also attached the resultant images generated over my end.

[C#]

// Open document<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/CourseOutline.pdf");

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)

{

using (FileStream imageStream = new FileStream("c:/pdftest/CourseOutline_image" + pageCount + ".png", FileMode.Create))

{

// Create Resolution object

Resolution resolution = new Resolution(300);

// Create PNG device with specified attributes

PngDevice pngDevice = new PngDevice(resolution);

// Convert a particular page and save the image to stream

pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);

// Close stream

imageStream.Close();

}

}