When I try to convert html to PDF using HiQPdf on Linux (on Windows works ok) I get this error:
Something went wrong: System.Exception: Cannot get the executing assembly directory. Empty directory
at hiqpdfimpl.ᤤ..ctor(ᤣ A_0)
at HiQPdf.HtmlToImage.ᜀ(String A_0, String A_1, String A_2, ᣩ& A_3, Hashtable& A_4)
at HiQPdf.HtmlToPdf.ᜀ(String A_0, String A_1, String A_2, String A_3, Boolean A_4)
at HiQPdf.HtmlToPdf.ᜀ(Stream A_0, String A_1, String A_2, String A_3, String A_4, Boolean A_5)
at HiQPdf.HtmlToPdf.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4)
at HiQPdf.HtmlToPdf.ConvertHtmlToMemory(String html, String baseUrl)
Now it's working on Linux starting from .NET Core. First of all you must get rid of
System.Drawing.Commonin your code because now it's only supported on Windows. You can use ImageSharp, SkiaSharp or Microsoft.Maui.Graphics instead. All of them are cross-platform.Then, install
libgdiplus.On ubuntu:
sudo apt-get install -y libgdiplusOn macOs (homebrew must be installed in your system):
brew install mono-libgdiplusRestart Nginx server:
sudo systemctl restart nginxIf the problem is still there, open terminal in project folder and make
nuget restore <Your-project-or.sln>