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

Free Support Forum - aspose.com

GDI+ error on conversion to Jpeg

I got “A generic error occurred in GDI+.” when trying to convert the sample Excel file to Jpeg. Please help to investigate. Thank you.

Environment: Aspose.Cells 22.3, .NET Core 6.0, CentOS 7

Sample: xlsx_sample.zip (596.0 KB)

Code sample:
using (var workbook = new Aspose.Cells.Workbook(inputFile))
{
var options = new ImageOrPrintOptions
{
OnePagePerSheet = false,
ImageType = ImageType.Jpeg,
PrintingPage = PrintingPageType.Default
};

foreach(var sheet in workbook.Worksheets)
{
var sr = new SheetRender(sheet, options);
for(int j = 0; j < sr.PageCount; j++)
{
var imgOut = $“Page_{j}”;
sr.ToImage(j, imgOut);
}
}
}

@dunghnguyen,

Thanks for the sample files.

Your issue might be due to environment problem, please confirm whether libgdiplus is installed under CentOS, it is required by the graphics library to render images. It can be installed by running the following command:

sudo yum install libgdiplus
cd /usr/lib
sudo ln -s libgdiplus.so gdiplus.dll

libgdiplus is indeed installed, conversion to Jpeg succeeded with other files. Can you please check again from your side?

@dunghnguyen,

We evaluated your issue a bit. We found the error might be caused by some chars on linux. We have logged a ticket with an id “CELLSNETCORE-376” for your issue. We will investigate and look into the details of your issue. We will try to devise some solution to cope with it.

Once we have an update on it, we will let you know here.

1 Like

Hi @dunghnguyen
We investigated and found that some special characters could not be drawn correctly under Linux by gid+,
We can only choose to skip these special characters to draw the whole picture. This will take effect in next version.
See image below. Output_CELLSNETCORE376.png (77.6 KB)

1 Like

@leoluo

Sound great! Thanks for your quick response.

Hi @dunghnguyen
Please get aspose.cells for netstandard 22.5 to fix this issue.
https://www.nuget.org/packages/Aspose.Cells/