I am using https://github.com/rdvojmoc/DinkToPdf DinkToPDF library to convert a html to PDF.
Everything working fine in local environment.
But in the dev environment, it throws some errors when converting html to pdf.
System.AggregateException: One or more errors occurred. (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: liblibwkhtmltox: cannot open shared object file: No such file or directory) ---> 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: liblibwkhtmltox: cannot open shared object file: No such file or directory at DinkToPdf.WkHtmlToXBindings.wkhtmltopdf_init(Int32 useGraphics)
I had tried below solutions, but they did not work.
- I added DinkToPdfCopyDependencies package but it works loclly but not works in dev env
<PackageReference Include="DinkToPdfCopyDependencies" Version="1.0.8" />
- then I copied package manually and
<None Update="libwkhtmltox.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="libwkhtmltox.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="libwkhtmltox.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
This also working in local environment, but when did not work in dev environment.
Anyone works with DinkToPDF, please help me fix this issue.
OR
Does anyone know any libraries to covert html to pdf in .NET 6 (Free and It should has MIT license)
Please suggest something. I am struggling with more than two days.