Hi Team,
We are facing issue System.Drawing.Common is not supported on non-Windows platform.
Exception thrown: ‘System.TypeInitializationException’ in System.Drawing.Common.dll
System.TypeInitializationException: The type initializer for ‘Gdip’ threw an exception.
—> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Learn for more information.
at System.Drawing.LibraryResolver.EnsureRegistered()
at System.Drawing.SafeNativeMethods.Gdip…cctor()
— End of inner exception stack trace —
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateRegion(IntPtr& region)
at System.Drawing.Region…ctor()
at #=z_aL8VQXoO3CxT0v_SpaU2N0CmIyZ8T6vJg==.#=z$yDO1QI=(#=zBMAZdRIAZoLwjH2gzd41OySr9hAWlcl5EA== #=zDyBqjB4=)
at #=zEzv$z2zkfX1TDKM9kZy3yD8ErKOcYWnTJl933D8=.Clone()
at #=zxrj4KUg1CpEiA2m$Gh_VP6efsSEGXInKynen7y0=.#=zNfW65OI=()
at #=z2SWwQqCeK640IC7bCsKpYGQdE7vSxZG0XDH5nAs=.#=zNfW65OI=()
at #=zQQQfENZTaKIKlWaAVsTwb2EtORt6.#=zqCnlY9pR42fb()
at #=zQNQCREwZ98k001Xsugn$PZ5izZakQL6lOzUckeR98F$B.#=zqCnlY9pR42fb()
at #=zQNQCREwZ98k001Xsugn$PZ5izZakQL6lOzUckeR98F$B.#=zh0D1WJ0IZf5C()
at #=zQNQCREwZ98k001Xsugn$PZ5izZakQL6lOzUckeR98F$B.#=zStB5fBg=()
at #=zKXTBi68KtkGWk6EKjkT0wpFiKWkoBscxqC9fwy11Ge_w.#=zGuNZzb4=(#=zHwGJLkDeZXzorkLaivBnsrKvGb2M #=zo9B9Di8=, #=zNDa3OtYUjlyMhd2pwb9Ahmc2mRM2e3zqyg== #=zRUk5cvU=, #=z8E6sfPfruhOHxqT0VnXFWQVA1Gs_u0L_2QTsQjuaxEup #=zYgKbAXU=)
at Aspose.Pdf.Page.CalculateContentBBox()
at Aspose.Pdf.Page.#=zBTJFTgA=(Page #=zRUk5cvU=)
at Aspose.Pdf.Page.#=zuwi5qU2SzdlsBEHGPA==()
at Aspose.Pdf.Document.ProcessParagraphs()
at Aspose.Pdf.Document.#=z3PzDI1h0iwDy(Stream #=zaU7ngSo=, SaveOptions #=za6Jkedt4YB14)
at Aspose.Pdf.Document.#=ziWj61LPZf9YV(String #=zerzOOAW38Q8b)
at Aspose.Pdf.Document.Save(String outputFileName)
We are deploying our application in a Linux container.
The following line were added to the Dockerfile.
RUN apt-get update && apt-get install -y libgdiplus
RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig