Unable to load shared library 'libwkhtmltox' or one of its dependencies
See original GitHub issueI’m having an issue with DInkToPDF on alpine docker, when i run my app i’m getting the following error.
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libwkhtmltox' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library liblibwkhtmltox: No such file or directory at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics) at DinkToPdf.PdfTools.Load() at DinkToPdf.BasicConverter.Convert(IDocument document) at TestPDF.Program.Main(String[] args) in /source/TestPDF/Program.cs:line 53
I have tried different solution that are posted by other peoples in this repo, nothing worked, So I have attached my docker file as well, please review and help me to solve this issue
Docker File
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source
COPY ["TestPDF/TestPDF.csproj", "TestPDF/"]
COPY ["TestPDF/libwkhtmltox.dll", "TestPDF/"]
COPY ["TestPDF/libwkhtmltox.dylib", "TestPDF/"]
COPY ["TestPDF/libwkhtmltox.so", "TestPDF/"]
RUN dotnet restore "TestPDF/TestPDF.csproj" -r linux-musl-x64
COPY . .
WORKDIR "/source/TestPDF"
RUN dotnet build "TestPDF.csproj" -c Release -o /app -r linux-musl-x64
FROM build AS publish
RUN dotnet publish "TestPDF.csproj" -c Release -o /app -r linux-musl-x64 --self-contained false --no-restore
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
WORKDIR /app
COPY --from=build /app ./
RUN mkdir documentengine
ENTRYPOINT ["dotnet", "TestPDF.dll"]
My application is a simple console app the render a pdf file, And I’m using 64bit native libraries.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top GitHub Comments
You are basically having the same issue I did. I think this wrapper must be reviewed. What I did is I’m using the base library https://wkhtmltopdf.org/ which does not have so many features. You can mix https://blog.elmah.io/generate-a-pdf-from-asp-net-core-for-free/ and https://code-maze.com/create-pdf-dotnetcore/ to make it work.
Same here How did you fix this?