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

Free Support Forum - aspose.com

When exporting pages as PNG charts are flipped

12345678.pdf (3.2 MB)

static void Main(string[] args)
{
FileStream stream = new FileStream(“c:\temp\12345678.pdf”, FileMode.Open);
Document doc = new Document(stream);
PdfPageEditor editor = new PdfPageEditor(doc);
using (MemoryStream memoryStream = new MemoryStream())
{
new BmpDevice(new Resolution(300)).Process(doc.Pages[15], memoryStream);
Image b = Bitmap.FromStream(memoryStream);
b.Save(“c:\Temp\savedimage.png”,ImageFormat.Png);
}

    }

@rileyja

We used following code snippet in our environment with Aspose.PDF for .NET 20.10 and did not notice any issue:

Document pdfDocument = new Document(dataDir + "12345678.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()
  {
   UseFontHinting = true
  }
 };
 pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);
 imageStream.Close();
 }
}

637383127127466082.png (237.3 KB)

Could you please try using latest version of the API with above code snippet and let us know in case you face any issue.

This fixes the issue. thank you.

1 Like