Aspose.PDF.DLL fails with "Cannot load Aspose.Fonts.DLL "

Trying to convert PDF to TIFF

Worked in version 11.5 - > 12.0

As of Version 16.1 (which has a smaller file size),

I receive the error "



Could not load file or assembly ‘Aspose.Font, Version=16.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)



Has this Aspose.Fonts been moved out of Aspose.PDF.DLL - can we obtain this file?



Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(@“c:test.pdf”);

Aspose.Pdf.Devices.TiffDevice tiffDevice = new Aspose.Pdf.Devices.TiffDevice(resolution, tiffSettings);

MemoryStream outStrm = new MemoryStream();

tiffDevice.Process(pdfDoc, 1,1, outStrm);

tiffs.Add(outStrm.ToArray());

Hi Mathew,


Thanks for contacting support.

I have tried to convert one of my sample PDFs into TIFF using Aspose.Pdf for .NET 17.4.0 and was unable to notice the exception which you have mentioned. Please note that it is always recommended to use latest version of the API as it contains all fixes, new features and enhancements.

Please try using latest version of the API to convert PDF into TIFF and in a case if you still face any issue please share more details regarding your environment (i.e OS information, Application Type, Target Framework) along with sample input document. This way, we can try to replicate the issue at our side and address it accordingly.


Best Regards,

Do you have a file called Aspose.Fonts.DLL on your system?


Apose.PDF.DLL is trying to load Aspose.Fonts.DLL

It appears I need this file Aspose.Fonts.DLL.

Yes. I have tried every version of Apose.Pdf.DLL

Versions 12.0 and earlier work.
Versions 16.10 and later through an exception with the message Aspose.Fonts.DLL cannot be loaded.

Please tell me if there is an Aspose.Fonts.DLL which is on your system and which is available for download.

Hi Mathew,


Thanks for writing back.

Please note that Aspose.Pdf for .NET is an independent library and does not require any other assembly to be used with it. Though Aspose.Font.dll, which you are talking about, is an internal component of Aspose.Pdf and it is protected.

As shared above, we will really appreciate if you please share information regarding your environment and functionality, which you are trying to implement and facing the issue. This way, we can try to replicate the issue in our environment and get back to you with some useful feedback.


Best Regards,
I'm experiencing the same issue. Anything before the jump to version 16+ works just fine. After I upgraded from 12 to 17 I started to get the same error.

Its important to note that the application runs just fine on my development box using the latest version of the library. The error occurs once I've pushed the web app to my test server which is a Windows 2008 R2 box.

Hi,


Thanks for contacting support.

The above stated problem is already logged as PDFNET-42378 in our issue tracking system. However currently there are two workarounds for this problem.

1.Do not use assembly.GetTypes(), use assembly.GetExportedTypes() instead.

System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(@“d:\MyApp\References\Aspose.Pdf.dll”);

var types = assembly.GetExportedTypes(); // <-- it works fine now and returns all public exported non-obfuscated classes.


2. Call assembly.CreateInstance(“Aspose.Pdf.Document”); after LoadFrom(), before GetTypes(). Something like this:

System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(@“d:\MyApp\References\Aspose.Pdf.dll”);

assembly.CreateInstance(“Aspose.Pdf.Document”);

var types = assembly.GetTypes(); // <-- it works fine now.


The product team is working on fixing this problem and we hope to get it resolved in next release versions of Aspose.Pdf for .NET. Please be patient and spare us little time. We are sorry for this inconvenience.

I’m not sure I follow. No where in my code am I making any of those calls. I’m just referencing the library in my project.

Found the problem.
I needed to implement an
AssemblyResoveHanlder within my code - and I was throwing an exception on a failed load.

When Apose.PDF version 16 and greater executes certain functions it fails to load Aspose.Fonts, and several other Aspose.* assemblies.
But those are not required to run successfully.

My fix is to write my AssemblyResolveHandler to ignore assemblies I don’t explicitly need.

Hi David,


Thanks for writing back.

driver:
I’m not sure I follow. No where in my code am I making any of those calls. I’m just referencing the library in my project.

As shared above, you may write your own AssemblyResolveHandler Event and call it after form load. This way you can ignore assemblies which will not be needed for the execution process of your application/program. As development team is resolving the issue and hopefully, a fix will be included in upcoming version of Aspose.Pdf for .NET, so you can implement this work around for now.

Your patience and cooperation is greatly appreciated in this matter. We will certainly share some definite updates with you, as soon as the issue is resolved. Please spare us a little time. We are sorry for the inconvenience.


Best Regards,

Hi Matthew,


Thanks for your feedback.

mcrose:
Found the problem. I needed to implement an AssemblyResoveHanlder within my code - and I was throwing an exception on a failed load. When Apose.PDF version 16 and greater executes certain functions it fails to load Aspose.Fonts, and several other Aspose.* assemblies. But those are not required to run successfully. My fix is to write my AssemblyResolveHandler to ignore assemblies I don’t explicitly need.

It is good to know that suggested work around resolved your issue. Please keep using our API and as far as the logged issue is concerned, we will keep you updated with the status of its resolution. Please be patient and spare us a little time. We are sorry for the inconvenience faced.


Best Regards,

Hi Mathew,


Thanks for your patience.

We are pleased to share that the issue reported earlier as PDFNET-42378 is resolved in latest release of Aspose.Pdf for .NET 17.6. Please try using the latest release and in the event of any further query, please feel free to contact.