I am trying to convert pdf to image document using .net 8 using Aspose.Pdf and it works fine in my local machine(windows). But i get an issue while running it in alpine linux server.
The exception looks like this
System.AggregateException: One or more errors occurred. (The type initializer for ‘Gdip’ threw an exception.)
—> 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.SafeNativeMethods.Gdip.<>c.<.cctor>b__2_0(String _, Assembly _, Nullable`1 _)
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
at System.Drawing.SafeNativeMethods.Gdip.g____PInvoke|32_0(IntPtr* __token_native, StartupInputEx* __input_native, StartupOutput* __output_native)
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInputEx& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip…cctor()
— End of inner exception stack trace —
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateMatrix2(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy, IntPtr& matrix)
at System.Drawing.Drawing2D.Matrix…ctor(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy)
at #=zCHl3SkG5wkA90MugFMD$bwVFbCtr7QnPt7qrsNQ=…ctor(Single #=zhK6P$xU=, Single #=zzslREYc=, Single #=zO1R7TGk=, Single #=zEbdxUF4=, Single #=zKjldTpk=, Single #=zhhd5Bhs=)
at #=zA7aN_PIrEpANf7hWsEOpslLbBIKuTwkJED1KGyJr9YNy.#=zH05g24fc2Oay(#=zJWvPQRDSw1wI1aaRBPcqarHvZI9NiJM7Tw== #=zAioM7v4=, #=zxKAo70E9lo_C8BMN56cAO7J9$i7Pu6rXpwyLFB8= #=zsws19IEG2_Fo, #=zDnPkXf2TZcGDHD9faZlJijvmQSrj4L6jlQ== #=zl235MT0=, Single #=zG5UHabh6t2ce, Single #=zo9f3y22gxEwm, Boolean #=z3kHkMJvRxYtieIc9kg==, Int32 #=zVEX0bGkpHnjw5J59e1Xvplg=, Boolean #=zSnrFkx4lGm8O, Double& #=zt1NxiOs=, Double& #=zbahmwa4=, #=zrqJr8NPFguLZQYihr1tIOKv8rdHZ08bG6w==& #=zFLtYEew=)
at #=zA7aN_PIrEpANf7hWsEOpslLbBIKuTwkJED1KGyJr9YNy…ctor(#=z5kEy0I8nwJ7zA08E53HCmWgD0RpI #=zV9xjgWo=, #=zJWvPQRDSw1wI1aaRBPcqarHvZI9NiJM7Tw== #=zAioM7v4=, #=zxKAo70E9lo_C8BMN56cAO7J9$i7Pu6rXpwyLFB8= #=zsws19IEG2_Fo)
at #=zb0erBJEZd320jOwmmmR4efYU0ESWO5BFoCfxll4=.#=z0uazCWqDYkBe(#=z5kEy0I8nwJ7zA08E53HCmWgD0RpI #=zV9xjgWo=, #=zJWvPQRDSw1wI1aaRBPcqarHvZI9NiJM7Tw== #=zAioM7v4=, #=zxKAo70E9lo_C8BMN56cAO7J9$i7Pu6rXpwyLFB8= #=zsws19IEG2_Fo)
at #=zEVopfVcJ8Xy1bxtjwprhx8eO6Y9l3RwyNN4yjYpGRGuO.#=zQw5nv1g=(#=z5kEy0I8nwJ7zA08E53HCmWgD0RpI #=zV9xjgWo=, #=zJWvPQRDSw1wI1aaRBPcqarHvZI9NiJM7Tw== #=zAioM7v4=, #=zxKAo70E9lo_C8BMN56cAO7J9$i7Pu6rXpwyLFB8= #=zm9W6zPs=, #=zA7aN_PIrEpANf7hWsEOpslLbBIKuTwkJED1KGyJr9YNy& #=zhgbSbLo=)
at #=zvOFLeziqL$npkFFs0vCvX6jDHBlQ.#=zDUKdOdY=(#=zA7aN_PIrEpANf7hWsEOpslLbBIKuTwkJED1KGyJr9YNy& #=zhgbSbLo=)
at #=zvOFLeziqL$npkFFs0vCvX6jDHBlQ.#=zDUKdOdY=()
at Aspose.Pdf.Devices.ImageDevice.#=zDUKdOdY=(Page #=zAioM7v4=)
at Aspose.Pdf.Devices.JpegDevice.Process(Page page, Stream output)
at Aspose.Pdf.Api.Core.Services.Impl.SinglePDFToImageService.SplitMultipleImages(String fileName, String commonTempDirectory, Byte[] pdfBytes, String rootFolder) in D:\Development Tools\bamboo-agent-home\xml-data\build-dir\MOZ-EAPACC0-JOB1\Aspose.Pdf.Api.Core\Services\Impl\SinglePDFToImageService.cs:line 176
at Aspose.Pdf.Api.Core.Services.Impl.SinglePDFToImageService.<>c__DisplayClass9_0.b__1() in D:\Development Tools\bamboo-agent-home\xml-data\build-dir\MOZ-EAPACC0-JOB1\Aspose.Pdf.Api.Core\Services\Impl\SinglePDFToImageService.cs:line 85
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
— End of stack trace from previous location —
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
— End of inner exception stack trace —
i have already installed libgdiplus and msttfontconfig in the linux container.
The exception is thrown in this method jpegDevice.Process(pdfDocument.Pages[1], memoryStream);
what can i do to fix the issue ?
Aspose.pdf version 24.9.0