Initializing PdfTron Fails on Azure AppService

Product: Pdftron pdfnetc64

Product Version: (for the netcore 2.1 assembly)

Please give a brief summary of your issue:
(Think of this as an email subject)

We are getting a ‘Bad image format’ exception when trying to initialize pdftron when we deploy a little service to an Azure Appservicem which runs on windows. Which exact DLLs do I need to use? I tried to follow this, after using the nuget package failed: PDFTron

Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B)
at pdftron.PDFNetPINVOKE.TRN_PDFNetInitializeEx(String lic_key, String json_string)
at pdftron.PDFNet.Initialize(String license_key)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:

The sample worked locally, but now does not start anymore when referencing the assemblies directly.
I realized it would be better to initialize pdftron later and catch any exception for a real service.



The Exception Info: System.BadImageFormatException error mainly comes from an architecture mismatch (ie. using the 64-bit dll in a 32-bit environment). I see from your .sln file that the debug and release configurations are set to AnyCPU.

Please make sure that you are setting the platform to 64-bit by going to Settings/Configuration/General settings/Platform to 64-bit in Azure portal.

Please let me know if this works for you.

1 Like

Thanks, that worked.