Free Support Forum - aspose.com

Aspose Exceptions - The type initializer for 'Gdip' threw an exception

HI,

We are trying to run a .Net Core application in Linux container and running into various issues while using Aspose various functionalities.

Aspose Functions we are using for:

-rob.pdf (386.2 KB)

1- Concatenate PDF files
[* Exception message: Incorrect file format (even though its correct pdf file) ]

Sample Code:

Aspose.Pdf.Facades.PdfFileEditor pdfEditor = new Aspose.Pdf.Facades.PdfFileEditor();
pdfEditor.Concatenate(inputMemoryStreams, outputMemoryStream)

2- Converting pdf file pages to “gif”, “bmp” etc to generate an image of a specific page
[* Exception message: The type initializer for ‘Gdip’ threw an exception. StackTrace: at System.Drawing.SafeNativeMethods.Gdip.GdipCreateMatrix2(Single m11, Single m12, Single m21, Single m22, Single dx, Single dy, IntPtr& matrix) ]

Sample Code:

Aspose.Pdf.Document inputPDFDocument = new Aspose.Pdf.Document(file);
inputPDFDocument.Pages[1].SendTo(new JpegDevice(width, height, resolution), outputMemoryStream);

3- Adding annotations to pdf pages
[* Exception message: Unexpected font parsing exception]

The code runs fine on local with windows system. But there are exceptions coming as we tried running same code on Linux machine.

Attached test pdf file we are using.

Thanks

@bhagyesh

Thank you for contacting support.

Would you please create a narrowed down sample application with us so that we may try to reproduce and investigate it in our environment.