rdvojmoc / DinkToPdf

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
MIT License
1.09k stars 417 forks source link

Unable to load shared library 'Shell32.dll' on Debian 9 #108

Open wasyster opened 4 years ago

wasyster commented 4 years ago

I am using DinkToPdf Library for pdf generation, but I encountered on a problme on Debian 9. I changed CustomAssemblyLoadConext to load the .so file like this

region DinkToPDF

if DEBUG

        string filePath = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\libwkhtmltox.dll";

else

        string filePath = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\libwkhtmltox.so";

endif

        CustomAssemblyLoadContext context = new CustomAssemblyLoadContext();
        context.LoadUnmanagedLibrary(filePath);
        serviceCollection.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

On Windows it is working perfect. On Linux (Debian 9) when I hit the controller to get a pdf file I got an error:

"Unable to load shared library 'Shell32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libShell32.dll: cannot open shared object file: No such file or directory"