Unable to use GdPicture in an Azure Function

Discussions about PDF management.
Post Reply
proit
Posts: 14
Joined: Wed Apr 20, 2011 10:28 am
Location: Switzerland
Contact:

Unable to use GdPicture in an Azure Function

Post by proit » Thu May 23, 2024 9:54 pm

Hi there

We want to use GdPicture in an Azure Function to manipulate pdf documents (removing blank pages, extract barcodes etc.). We added the latest GdPicture.Api nuget package. The Azure Function itself runs as .net 8 isolated process in the consumption plan on linux. Whenever we try to initiate GdPicture we get the following error:

Code: Select all

System.Exception: GdPicture runtime exception: Can not find GdPicture.NET.14.filters.64.so. Please, copy last version of this dll into your application directory at: /home/site/wwwroot
   at GdPicture.Internal.Imaging.ImageFiltering.FiltersImports.ᜀ(Boolean A_0)
   at GdPicture.Internal.Imaging.ImageFiltering.FiltersImports.ᜀ(Boolean A_0)
   at GdPicture.Internal.Globals.GdPictureToolkit.Initialize(Boolean forceInitialization, Int32 maxTreads)
   at GdPicture14.LicenseManager..ctor()
   at Comatic.Erp.DocuScan.Functions.Services.PdfService..ctor(ILogger`1 logger, IOptions`1 settings) in /home/vsts/work/1/s/src/Comatic.Erp.DocuScan.Functions/Services/PdfService.cs:line 34
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.Azure.Functions.Worker.DefaultFunctionActivator.CreateInstance(Type instanceType, FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionActivator.cs:line 23
   at Comatic.Erp.DocuScan.Functions.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in /home/vsts/work/1/s/src/Comatic.Erp.DocuScan.Functions/obj/Release/net8.0/Microsoft.Azure.Functions.Worker.Sdk.Generators/Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator/GeneratedFunctionExecutor.g.cs:line 51
   at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
   at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 38
   at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89
   at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a\_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
The required files are not located in the root directory but in the sub folder runtimes\linux-x64\native.

When I debug the function locally everything works as expected.

What do we have to change so that GdPicture can be used in an Azure Function running on the linux stack in .net 8?

Thank you for your help.
Michael

proit
Posts: 14
Joined: Wed Apr 20, 2011 10:28 am
Location: Switzerland
Contact:

Re: Unable to use GdPicture in an Azure Function

Post by proit » Fri May 31, 2024 9:04 pm

Anyone?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests