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

Free Support Forum - aspose.com

Pdf to png issues

We have purchased purchased the pdf to png license and in some cases the png conversion has blue squares or shapes instead of the initial colors or artwork.

Screen Shot 2020-07-19 at 4.46.16 PM.jpg (884.1 KB)

@ecolliot

Can you please confirm which API you are using on your end. Is it Aspose.PDF or Aspose.Imaging?

@mudassir.fayyaz - I believe we have both… Below is a screen shot. I really don’t understand this platform.

Screen Shot 2020-07-22 at 9.40.40 AM.png (80.4 KB)

@ecolliot,

Can you please share the source file, generated output and used code. From issue description: PDF to PNG issues, it is apparent that you are using Aspose.PDF as Aspose.Imaging does not provide support for converting PDF to PNG.

@mudassir.fayyaz

here is the pdf and the png

png.png (66.9 KB)
Classroom-Greetings-during-social-distancing-637307918893819932 (1).zip (1.5 MB)

@ecolliot

We have used following code snippet with Aspose.PDF for .NET 20.7 and were unable to notice any issue:

Document pdfDocument = new Document(dataDir + "1-1-Classroom Greetings.pdf");
string tmpImgToInsert = DateTime.Now.Ticks + ".png";
using (FileStream imageStream = new FileStream(dataDir + tmpImgToInsert, FileMode.Create))
{
  Resolution resolution = new Resolution(300);
  PngDevice pngDevice = new PngDevice(resolution);
  pngDevice.Process(pdfDocument.Pages[1], imageStream);
  imageStream.Close();
}

637311319394418822.jpg (1.3 MB)

Would you please make sure that you are using latest version of the API. In case you still face any issue, please share sample code snippet with us that you are using at your side. We will test the scenario again and share our feedback with you.

Hi @asad.ali

What is the latest version of the API? Where can I get it?

Thanks,
Emmanuel

@ecolliot

The latest version is Aspose.PDF for .NET 20.7 and every month we release a new version with more fixes and enhancements. You can download it from NuGet Gallery OR install it directly into your project using NuGet Package Manager.

@asad.ali so we finally got around to updating the version and license to the latest version and that still doesn’t solve the issue.

The following pdf doesn’t convert to png as you can see from the attached screens.

1-1-Classroom Greetings 2.pdf (1.5 MB)
Screen Shot 2020-08-30 at 4.35.07 PM.jpg (260.2 KB)

Are you able to help us? What could be the issue? What would you need from me to resolve the issue?
Very best,
Emmanuel

@ecolliot

We used the following code snippet to convert the PDF into PNG images with Aspose.PDF for .NET 20.8 and did not notice any issue in resultant images:

Document pdfDocument = new Document(dataDir + "1-1-Classroom Greetings 2.pdf");

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
 string tmpImgToInsert = DateTime.Now.Ticks + ".png";
 using (FileStream imageStream = new FileStream(dataDir + tmpImgToInsert, FileMode.Create))
 {
  var pngDevice = new PngDevice(new Resolution(300))
  {
   RenderingOptions = new RenderingOptions()
   {
    OptimizeDimensions = true,
    InterpolationHighQuality = true,
    UseNewImagingEngine = true
   }
  };
  pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);
  imageStream.Close();
 }
}

637345218544454090.png (743.7 KB)
637345218535399294.png (173.3 KB)
637345218459932371.jpg (919.5 KB)

Would you please try a shared code snippet with latest version of the API and if an issue still persists, please let us know.