Comments (9)
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.
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.
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.
I've installed libjpec, but it doesn't work.
wkhtmltopdf http://xxx /opt/xxx.pdf
but this it works
from wkhtmltopdf-dotnet.
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.
i see,thanks
from wkhtmltopdf-dotnet.
@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.
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.
@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)
- Table of content styling HOT 2
- Exclude runtimes folder from publish HOT 2
- libwkhtmltox using produceForms html form to pdf form does not work HOT 2
- Local file access HOT 1
- Gmail is detecting pdf generated by WkHtmlToPdf-DotNet as malware HOT 1
- creating pdf with .net6 in aws lambda HOT 4
- Not able to generate report once deployed to Kubernates HOT 1
- Execution time increases under load HOT 1
- I didn't use dependency injection. Using static creation would cause the thread to get stuck and new requests to keep getting stuck HOT 22
- % in the href attribute are still encoded to %25 HOT 2
- Not reading settings on alpine HOT 2
- HTML tags removed HOT 3
- Reporting a vulnerability HOT 1
- In Linux CentOS 7, there was an error: Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported. HOT 3
- Memory overflow HOT 2
- The wkhtmltopdf project that is used, is no longer maintained HOT 3
- Display flex is not working HOT 1
- Unable to load native library - Windows 10/11 HOT 16
- Add ability to process pdf generation on multiple threads HOT 1
- How can I set html code with css in header HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wkhtmltopdf-dotnet.