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

Free Support Forum - aspose.com

Scanned PDF incorrectly rendered into PNG with unreadable pages using Aspose.PDF (C#)

Hello!!
I’m having an issue when converting a PDF to PNG with some scanned documents. Some pages are unreadable, no matter which resolution I use with the PngDevice. I’ve tried several resolution settings or rendering options, with no better results.
This is the code I’m using:

public static void ImageConverter(String nameMask){
	Document doc = new Document(System.Web.HttpContext.Current.Server.MapPath("/DoctosAspose/Convert/output" + nameMask + ".pdf"));
	int TotalPages = doc.Pages.Count;

	for (int pageCount = 1; pageCount <= TotalPages; pageCount++)
	{
		using (FileStream imageStream = new FileStream(System.Web.HttpContext.Current.Server.MapPath("/DoctosAspose/Input/image" + nameMask + "-1" + pageCount + ".png"), FileMode.Create))
		{
			//I've tried with different resolution settings.
		//create PNG device with specified attributes
			//var res = new Resolution(300);
			//var res = new Resolution(300,300);
			//PngDevice pngDevice = new PngDevice(res);
			
			PngDevice pngDevice = new PngDevice(); //default constructor at 150dpi
			
			//pngDevice.RenderingOptions.UseNewImagingEngine = true;
			//pngDevice.RenderingOptions.ScaleImagesToFitPageWidth = true;
			//pngDevice.RenderingOptions.InterpolationHighQuality = true;

			//Convert a particular page and save the image to stream
			pngDevice.Process(doc.Pages[pageCount], imageStream);

			//Close stream
			imageStream.Close();			
		}This text will be hidden
	}	
}

The original document and the first four pages converted to png. Just the first page is readable:
input3742019020654491112010420.pdf (574.3 KB)
image3742019020654491112010420-2.jpg (247.3 KB)
image3742019020654491112010420-1.png (128.8 KB)
image3742019020654491112010420-4.png (67.0 KB)
image3742019020654491112010420-3.png (229.4 KB)

Any help will be appreciated, because I have my clients urging me for this, and is the only issue that I’ve been unable to fix.

@anbernardi

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46011 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Is there any news about this? Is this issue present in version 19?

anbernardi

Please note PDFNET-46011 was reproduced with Aspose.PDF for .NET 19.1 and has not been resolved yet owing to previously logged tickets.

It has been logged under free support model where issues have low priority and are resolved on first come first serve basis. The resolution of the logged issue may take several months depending upon how long is the queue of previously logged issues. Whereas, issues have high priority in paid support model and are dealt with high precedence. Paid support option is recommended for the customers who want their issues to be resolved on urgent basis.

As soon as we have significant updates regarding resolution of your issue, we will surely inform you in this very thread. Please be patient and spare us little time.

Thanks for your answer. I’ll keep waiting.

@abernardi

We appreciate your patience and comprehension in this regard.

Is there any news? I’m still facing this problem, and I’ve updated my lib version to 19.10.0.AposePDF unreadable VS Acrobat PDF.png (384.6 KB)

@abernardi

We are afraid PDFNET-46011 is still unresolved owing to previously logged and critical tickets. However, we have recorded your concerns and will let you know once any update will be available in this regard.

For the moment, using
p.RenderingOptions.UseNewImagingEngine = false;
solved the issue with version 20.1.0.

Anyway, I’ll be pleased if you find a solution.

@abernardi,

I like to inform that we are working on this and will share good news with you soon.