System.TypeInitializationException: The type initializer for '?.?' threw an exception

Hi,

My company uses an application which in turn uses the Aspose PDF component for creating PDF documents.

Recently we've been experiencing an error when trying to create a PDF document and we receive the following message:

System.TypeInitializationException: The type initializer for 'ᠥ.㼂' threw an exception

The event viewer shows the following:

Message: System.TypeInitializationException: The type initializer for 'ᠥ.㼂' threw an exception. ---> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)

at ᠥ.㼂..cctor()

--- End of inner exception stack trace ---

at ᠥ.㼂..ctor(㢊 part)

at ᠥ.㭐.ᰨ(㬶 Ս)

at 㪍.㿤.㪷(㭐 㿮, ӟ 㼈)

at Aspose.Words.Document.SaveToPdf(Int32 pageIndex, Int32 pageCount, Stream stream, PdfOptions options)

at CdcSoftware.Respond.BusinessLayer.CaseManagement.EntityManager.GetPdfFileData(Byte[] wordFileData)

at CdcSoftware.Respond.BusinessLayer.CaseManagement.EntityManager.SaveTemplateAttachmentDataToDatabase(Case caseEntity, Attachment attachment, Byte[] data, DateTime lastModifiedTime)

Does anyone know what might cause this and how we can resolve? When this has happened previously the problem seemed to resolve itself without any action (ie no server reboot, s/w install etc).

Thanks in advance for any help.

Phil

Hi Phil,

Thanks for your inquiry.

It appears that you are using a very old version of Aspose.Words as the latest versions of Aspose.Words for .NET do no longer contain a definition for “SaveToPdf” method. So, I would suggest you please upgrade to the latest version from the following link. I hope, this helps.

Secondly, you can easily render any Microsoft Word document ( e.g. DOC, DOCX, RTF etc ) to PDF format. I would suggest you please read the following article for more details:

Also, please visit the following link to learn how to migrate to Aspose.Words 9.2 or higher:

Please let me know if I can be of any further assistance.

Best regards,

Hi Awais,


We are facing a similar issue.
Before upgrading to the new Aspose.Words, would like to know if there was an Known issue related to “SaveToPdf” which fails while saving the image. If yes, is it fixed so that we can migrate to a later version.

Thanks,
Mario

Hi Mario,

Thanks for your inquiry. Unfortunately, we don’t provide support for older released versions of Aspose.Words. We always encourage our customers to use the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that were reported earlier. So, I would suggest you please upgrade to the latest version of Aspose.Words for .NET (13.9.0). You can download it from the following link:

Best regards,