Aspose.Imaging for .NET 6 is throwing error in non-windows deployment

Hi Team,

we’re currently using .NET 6 and Aspose.Imaging, Aspose.Cells and Aspose.Zip, we see no issues with Cells and Zip, latest version of Cells is using SkiaSharp and Not System.Drawing.Common, but even with the latest version of Imaging, we’re getting error, perhaps this is because even latest version of Aspose.Imaging is using System.Drawing.Common.

Error thrown below is for Aspose.Imaging 22.9.0 when deployed in alpine OS

System.AggregateException: One or more errors occurred. (Font '?' cannot be found.)
 ---> System.ArgumentException: Font '?' cannot be found.
    at System.Drawing.SafeNativeMethods.Gdip.CheckStatus(Int32 status)
       at System.Drawing.FontFamily.GetGdipGenericSansSerif()
          at System.Drawing.FontFamily.get_GenericSansSerif()
             at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)
                at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
                   at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style)
                      at \u000E\u0002\u000F\u0005.\u0002(String \u0002, Font \u0003, ImageOrPrintOptions \u0005)
                         at \u0008\u001B\u0017\u0003.\u0002(Chart \u0002, Boolean \u0003)
                            at \u0008\u001B\u0017\u0003.\u0002(Chart \u0002, Stream \u0003, ImageType \u0005)
                               at \u0008\u001B\u0017\u0003.\u0002(Stream \u0002, Chart \u0003)
                                  at Aspose.Cells.Charts.Chart.ToImage(Stream stream, ImageOrPrintOptions options)  

The same is working when we deploy in debian OS

Can you let us know how can we fix this?

Thanks

@shivanandchikkalli Aspose.Imaging has a version that supports Aspose.Drawing as the default graphics engine instead of System.Drawing.Common. You can download and try it from https://www.nuget.org/packages/Aspose.Imaging/22.10.0-beta.

Hi Alexey,

I have the same problem but i’m using c# 7.0 in ubuntu.
I use Aspose.Imaging 22.11 version but gives the same error. This version have the fix that you mention?
I try with version 23 but still the same problem,

This is the code that I use:
Aspose.Imaging.License lic = new Aspose.Imaging.License();
lic.SetLicense(license);
using Aspose.Imaging.Image img = Aspose.Imaging.Image.Load(input);
img.Save(convertedFile, new Aspose.Imaging.ImageOptions.PdfOptions());
img.Dispose();

In the Visual Studio the Aspose.Imaging still depending from system.drawing.Common
image.png (3.2 KB)

This problem occurs with other components like Aspose.Slides.

I’m doing something wrong?

Thanks in advance

@Alexey.Karpenko: Is this fix only available in 22.10.0-beta or can we use any latest version?

@nsemedo Currently, only the beta version mentioned provides support for Aspose.Drawing instead of System.Drawing.Common. However, we have plans to release Aspose.Imaging for .NET7 in upcoming releases, which will have Aspose.Drawing as the default graphics engine.

@rajeshpv Currently, only the beta version mentioned provides support for Aspose.Drawing instead of System.Drawing.Common. However, we have plans to release Aspose.Imaging for .NET7 in upcoming releases, which will have Aspose.Drawing as the default graphics engine.

Hi Alexey,

thanks for the reply i will test this version.
Can you know if Aspose.Slides have the same beta version to test.
We need to convert documents from pptx to PDF and we use this lib, but with the same error.

Thanks
Nuno Semedo

@nsemedo,
Please check your results using the latest version of Aspose.Slides for .NET if it is possible. If the issue persists, please create a new forum thread on Aspose.Slides forum and share the following:

  • code example that reproduces the error
  • input files (if they were used)
  • stacktrace of the error
  • OS version on which the code was executed
  • .NET target platform in your app
  • Aspose.Slides version you used