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

Free Support Forum - aspose.com

Corrupted .png file

Hello I’m using your library for a long time. And I didn’t have any issues with documents in my buisness logic. I used your library in couple with MagickImage. And I encountered on file that renders corrupted .png. It can be opened with any viewer but MagickImage library can’t work with it because it has extra incorrect IDAT chunk. More detailed explanation is here


For testing purpose I wrote this code snippet(if you need I will able to send you that library, but you can check this issue just by opening Page6.png). So Page6.png that will generate this logic will have extra data. ONLY this page. I don’t know what is the reason. Also I attached that XLS file.

var lic = new License();
var options = new ImageOrPrintOptions();
options.HorizontalResolution = 100;
options.VerticalResolution = 100;
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
options.OnlyArea = true;
options.Quality = 100;
var _xlsDocument = new Workbook(“test.xlsx”);
var workSheet = _xlsDocument.Worksheets[0];
int maxRow = workSheet.Cells.MaxDataRow > workSheet.Cells.MaxRow ? workSheet.Cells.MaxDataRow : workSheet.Cells.MaxRow;
int maxColumn = workSheet.Cells.MaxDataColumn > workSheet.Cells.MaxColumn ? workSheet.Cells.MaxDataColumn : workSheet.Cells.MaxColumn;
workSheet.PageSetup.PrintArea = String.Format("{0}:{1}", “A1”, workSheet.Cells[maxRow, maxColumn].Name);
workSheet.PageSetup.TopMargin = workSheet.PageSetup.BottomMargin = workSheet.PageSetup.LeftMargin = workSheet.PageSetup.RightMargin = 0;
workSheet.PageSetup.PrintTitleColumns = workSheet.PageSetup.PrintTitleRows = null;
workSheet.PageSetup.FitToPagesTall = workSheet.PageSetup.FitToPagesWide = 0;
var sheetRender = new SheetRender(workSheet, options);
for (int pageIndex = 0; pageIndex < sheetRender.PageCount; pageIndex++)
sheetRender.ToImage(pageIndex, “Page” + pageIndex + “.png”);
new MagickImage(“Page” + pageIndex + “.png”); //this row can be deleted;
catch (Exception ex)

Hi Samsen,

Thank you for using Aspose APIs.

I have evaluated your presented scenario while using the latest major version of Aspose.Cells for .NET (Latest Version) and Magick.NET (Magick.NET-, however, I am not able to observe any exception executing your exact code. If you are using any older revisions of both API, we strongly suggest you to give the latest versions a try on your side to feed us back with your results.