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

Free Support Forum - aspose.com

Aspose.Pdf .Net thows error because of System.Drawing.Common dependency in dotnet 6.0 when using linux

Please look at my sample project here. I have dockerfile in the project as well.
I have installed libgdiplus and installed nuget package SkiaSharp.NativeAssets.Linux.NoDependencies

I am trying to remove black pages from pdf using aspose pdf.

This line https://github.com/sunilshahi/AsposePdfNet6/blob/master/AsposePdfNet6/Pages/Privacy.cshtml.cs#L55
and
https://github.com/sunilshahi/AsposePdfNet6/blob/master/AsposePdfNet6/Pages/Privacy.cshtml.cs#L32

throws exception.

This is only happening in linux not on windows.

-------EXCEPTION--------

The type initializer for ‘Gdip’ threw an exception.

at System.Drawing.SafeNativeMethods.Gdip.GdipCreateMatrix2(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy, IntPtr& matrix)
at #=zc37PDvqhjJhFJ7Th$yP201U$ylaf74hg2w==.#=zvqZkU0g=(Single #=zsVIZ3L4=, Single #=zF9KnC$Q=, Single #=z28gG5ds=, Single #=zEr3XCA4=, Single #=zpRv0CwI=, Single #=zhcritWg=, #=zV71mTzZAOL89qaDq0fysgUMUk5rsWUFSSg== #=z1Er4bdQ=)
at #=z8ji8PcCb1ywUbV4y6UiEKs9xkoNoXfSJQWMKzN_TYhwI.#=zAUwQXE5efflE(#=z1nNf2afKdyI9MKLxx_oOlwlFofIwSimeyg== #=zVj3TBps=, #=za8ZRH_0Yk2d99N6q91dzRSae9vaQEnNnIFYqn1c= #=z6Nli1WEjRgpZ, #=zkQi4kBA04vuavCks9LRrOL9JMruGnvdvOQ== #=zPlHPmMg=, Single #=zctvlxpXr1JIL, Single #=zovwo0Rw_96ma, Boolean #=zC6NrB7mbgPpekgxkBg==, Int32 #=zC9yKE0l5YpUdA5uH_xtuG0I=, Boolean #=zu0fpoc6yN1UL, Double& #=zxx6_4PU=, Double& #=zDyW2pao=, #=zIRn9vQD5BlbDNj46oHuAkXqu6SeIzfa9ZQ==& #=zp85Nw$4=)
at #=z8ji8PcCb1ywUbV4y6UiEKs9xkoNoXfSJQWMKzN_TYhwI…ctor(#=z$GtRQPT4_T3dmyQTgv1g6IQsW2Ff #=zRl0TbqM=, #=z1nNf2afKdyI9MKLxx_oOlwlFofIwSimeyg== #=zVj3TBps=, #=za8ZRH_0Yk2d99N6q91dzRSae9vaQEnNnIFYqn1c= #=z6Nli1WEjRgpZ)
at #=zYkBljhijl77Uqw19zwhMulrfZyQY_F9QNFxvR9E=.#=zLwInxTqVw$UL(#=z$GtRQPT4_T3dmyQTgv1g6IQsW2Ff #=zRl0TbqM=, #=z1nNf2afKdyI9MKLxx_oOlwlFofIwSimeyg== #=zVj3TBps=, #=za8ZRH_0Yk2d99N6q91dzRSae9vaQEnNnIFYqn1c= #=z6Nli1WEjRgpZ)
at Aspose.Pdf.Page.IsBlank(Double fillThresholdFactor)
at AsposePdfNet6.Pages.PrivacyModel.OnGet() in C:\Users\Sunil\source\repos\AsposePdfNet6\AsposePdfNet6\Pages\Privacy.cshtml.cs:line 32
at lambda_method27(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.ActionResultHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()

-----INNER EXCEPTION----
System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrawingnonwindows for more information.

at System.Drawing.LibraryResolver.EnsureRegistered()
at System.Drawing.SafeNativeMethods.Gdip…cctor()

@pratyushrai

We already logged an issue to test Aspose.PDF functionality under .NET 6.0 in non-Windows environments as PDFNET-50918. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks for the response @tahir.manzoor

Is there a official versions compatibility chart vs different OS for aspose pdf and aspose words. We were planning to migrate to dotnet 6 and start using linux seems like this is the only blocker. We updated our license just for this only to realize this is not supported in linux. Any pointers to what our options are at this point would be helpful.

Thanks

@pratyushrai

Unfortunately, there is no compatibility chart vs different operating systems. However, you can find your required detail in following articles of Aspose.PDF and Aspose.Words.