PDFtron NetCore not working with azure functions hosted on linux


Product Version: 9

Please give a brief summary of your issue:issuses when running on Azure functions hosted on Linux Consumption plan

unable to load shared library ‘pdfnetc’ or one of its dependencies azure functions
Please describe your issue and provide steps to reproduce it:

Note that you need two files, PDFNetDotNet.dll and libPDFNetC.so. That error message could be caused if you did not also deploy libPDFNetC.so in the same folder as PDFNetDotNet.dll.

Which exact PDFTron SDK are you downloading (url)?
What .NET framework are you targetting? e.g. .NET5?
Do you know the exact linux distro you are using? e.g. Debian 10

I am trying to deploy/publish from windows platform using vs2019. performed steps listed here

still getting the error.

Target framework : dotnet (core 3.1)
trying to publish to azure functions hosted on linux so that i can use comsumption plan…is there any other way i can use consumption plan with pdftron

Trying to run app with linux container using vs2019

Are you getting the error on Windows? Or Linux? Or Both?

publish to azure functions

What is the exact Azure Function configuration you are using?

Trying to run app with linux container using vs2019

Could you provide screenshots showing your VS2019 project/dependencies

Finally, please provide the full/detailed exception message, including the callstack (there should be more information than what you initially provided).

I am getting error in linux and for windows getting error on consumption plan for azure functions

I tried multiple options basically want to run pdftron with azure function consumption plan/aws lambda

Error message

“errorType”: “DllNotFoundException”,
“errorMessage”: “Unable to load shared library ‘PDFNetC’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libPDFNetC: cannot open shared object file: No such file or directory”,
“stackTrace”: [
“at pdftron.PDFNetPINVOKE.TRN_PDFNetInitializeEx(String lic_key, String json_string)”,
“at pdftron.PDFNet.Initialize(String license_key)”,

Thank you for confirming that you are reporting the error on Linux, and that libPDFNetC.so is not being found by the .NET runtime.

You need to make libPDFNetC.so available to the .NET runtime by doing one of the following.
a) the same directory as PDFTronDotNet.dll
b) current working directory
c) in LD_DEBUG environment variable.

Based on your screenshot none of the above have been satisfied (eg. is output directory where you copy libPDFNetC.so to an actual folder the .NET runtime is checking?).

Yes i am copying the lippdfc.so to bin directory where PDFTronDotNet.dll is placed

Also can you help me with steps so that i can use pdftron with windows on azure functions with consumption plan

This conversation keeps switching between Windows and Linux which is making it difficult to assist you. If you are having issues with both, then we should only focus on one at this time.

In your latest message you say “…help me with steps so that i can use pdftron with windows on azure functions…”, in which case there are two obvious issues.

i) Upgrade to latest 9.1 SDK version, as we removed a GDI+ dependency that causes this error on Windows:

ii) Deploy the PDFNetC.dll that comes in the above link, since that is missing in your screenshot above.

If the above does not help, then please confirm:
Are you deploying to Windows or Linux Azure Function instance?
If both, then please let me know which one you want to discuss and resolve first (and provide latest details)?

1 Like

HI @Ryan ,

Apologies that i didnt respond to you for quite a while, however the pdftron dll provided by you worked with azure functions in consumption plan on WINDOWs.

Have noticed a issuse with this .core version for many of the documents using text extraction module of dll , it is extracting symbols/junk characters whereas .net framework version of the dll is extracting it correctly.

We would need the PDF file in question then to reproduce. If you cannot provide the PDF here then please create a private ticket here: https://www.pdftron.com/form/request/

HI @Ryan ,