Closed power911 closed 2 years ago
Yes, .NET6 is supported, the issue is most likely that you're missing a native dependency (like the error message says).
Yes, .NET6 is supported, the issue is most likely that you're missing a native dependency (like the error message says).
How to fix this issue? Do you have any solutions? We get this on Win10
I recommend that you read through the other issues here to see if you can figure out what's going on. Maybe try the wkhtmltopdf native package first and go from there.
I'm having the same issue. Did you find a solution, @power911?
I'm trying to use the library in an Azure Function. It works on Windows. On Linux and Mac it doesn't work. However, when running from a unit test project it works on my Mac 🤷🏻♂️
@nielslbeck Make sure you're not on a consumption plan in Azure, I don't think they support native libraries.
Im having the same issue on S1. I have verified that the /home/site/wwwroot/bin/runtimes/linux-x64/native/libwkhtmltox.so exists. Any suggestions on where to look further?
Thanks!
Most likely an issue with dependencies, make sure you can run it locally first.
I think you are correct. It looks like the dependencies for libwkhtmltopdf.so are not available on the default image for azure functions. Does that sound right to you? I am hoping to avoid using docker if possible. Any help to get the right libs in place is much appreciated.
Yeah, the native library does require libjpeg, etc. The easiest is to just install the package for the wkhtmltopdf from their site, which will install the dependencies and this wrapper should work.
I was hoping to avoid that if at all possible since that will require a custom container. Do you know of anyone that has been able to get this to work in Azure functions without Docker?
If you have root access to the node then I think installing the native library (wkhtmltopdf) is the best way. If it's a managed container then docker is the best option IMO. In fact, I'm not sure if you can install anything in Azure Functions without it being in Docker?
I know on python you can use pip to install libraries which has gotten me around this in the past. However, I do not see a way to do that using the dotnet runtime.
With that said, I switched over to using the Azure functions docker container and was able to get it running locally. I have not had a chance to deploy it to Azure yet but I don't see any reason it wouldn't work there. I will report back if it fails for some reason.
Thanks for putting this library together and for your help!
P.S. Here is the docker file I am using in case it's helpful to someone:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS installer-env
COPY --from=mcr.microsoft.com/dotnet/core/sdk:3.1 /usr/share/dotnet /usr/share/dotnet
COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
dotnet publish *.csproj --output /home/site/wwwroot
FROM mcr.microsoft.com/azure-functions/dotnet:4
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
#Added this:
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated wkhtmltopdf \
&& rm -rf /var/lib/apt/lists/*
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
I think you're mixing the "domains". pip for Python installs Python-dependencies, same as NuGet for .NET. But the issue here is that you need native dependencies (native meaning libraries coded in C++, etc, compiled into binaries). Wkhtmltopdf is such a library and that's why you need to install its dependencies outside of the managed domain (Python or .NET). Which you basically need root access to do, which docker allows you. We have a docker example in the source code samples.
Hi, we are using WkHtmlToPdfDotNet 1.5.66 with .net 6, and when i try to convert html to pdf, get all time error
WkHtmlToPdfDotNet supported .net6?