Coder Social home page Coder Social logo

centos8 Error about wkhtmltopdf-dotnet HOT 9 CLOSED

hakanl avatar hakanl commented on July 19, 2024
centos8 Error

from wkhtmltopdf-dotnet.

Comments (9)

WalissonPires avatar WalissonPires commented on July 19, 2024 1

I downloaded the project to my server where I was having the problem and ran some tests.

I added some logs in the ModuleFactory file's try/catch and found the error was as follows:

Unable to load shared library 'runtimes/linux-x64/native/libwkhtmltox' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 

/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/runtimes/linux-x64/native/libwkhtmltox.so: cannot open shared object file: No such file or directory
libpng16.so.16: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/runtimes/linux-x64/native/libwkhtmltox: cannot open shared object file: No such file or directory\n/root/WkHtmlToPdf-DotNet/src/TestConsoleApp/bin/Debug/net7.0/runtimes/linux-x64/native/libwkhtmltox: cannot open shared object file: No such file or directory

The lib libpng16.so.16 was missing and I had installed the following libs:

libpng.so.3
libpng.so.3.50.0
libpng12.so.0
libpng12.so.0.50.0
libpng15.so.15
libpng15.so.15.13.0

Apparently CentOS 7 doesn't support libpng16. I found it only for CentOS 8+.

But this only happened when using via C# code. Running wkhtmltopdf via terminal worked fine.

Then I copied the /usr/local/lib/libwkhtmltox.so file (created from the manual installation of wkhtmltopdf ) to the runtimes/linux-x64/native folder of the project. Replacing the version that came from nuget. This solves the problem.

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024 1

The native library that is included in the C# project is from the wkhtmltopdf project, and it linked to specific versions of the dependencies. Other compiled libraries may have different dependencies, it doesn't mean much, but the bottom line is if you want to use the included native library then you need to have the exact dependencies met.

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024

The issue is most likely related to missing dependencies in your environment, it's most likely not an issue with this .NET wrapper.

from wkhtmltopdf-dotnet.

shanxixiaohuozi avatar shanxixiaohuozi commented on July 19, 2024

I've installed libjpec, but it doesn't work.
wkhtmltopdf http://xxx /opt/xxx.pdf
but this it works

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024

Since this is just a wrapper in .NET for the native library, most likely there's some missing dependency in your system.

from wkhtmltopdf-dotnet.

shanxixiaohuozi avatar shanxixiaohuozi commented on July 19, 2024

i see,thanks

from wkhtmltopdf-dotnet.

WalissonPires avatar WalissonPires commented on July 19, 2024

@shanxixiaohuozi Did I manage to solve the problem? I have the same problem with CentOS 7.
Running wkhtmltopdf in the terminal works fine. But via C# gives the same error.

How could I know which dependency is missing?

from wkhtmltopdf-dotnet.

WalissonPires avatar WalissonPires commented on July 19, 2024

Could someone tell me why running wkhtmltopdf directly from the terminal works and via C# code doesn't?

(I installed wkhtmltopdf as root)

CentOS Linux release 7.9.2009 (Core)
wkhtmltopdf 0.12.5 (with patched qt)

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024

@WalissonPires Most likely it's because the binary that is used in the terminal has other dependencies that are met, than the library that is used by the C# code. There are some ways to figure out what library Linux tries to load, maybe you can try something like that. I'm almost certain it's a dependency problem.

from wkhtmltopdf-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.