3

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)
zielu1
  • 1,308
  • 11
  • 17
  • Hello. It certainly does not work in Linux for me either with the same error message. I also sent an e-mail to their support over a month ago with no reply. They don't seem to care. – Totty Feb 19 '20 at 08:40
  • I received reply from support confirming that Linux isn't supported yet. – zielu1 Feb 28 '20 at 08:28

1 Answers1

0

Now it's working on Linux starting from .NET Core. First of all you must get rid of System.Drawing.Common in 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 libgdiplus

On macOs (homebrew must be installed in your system): brew install mono-libgdiplus

Restart Nginx server: sudo systemctl restart nginx

If the problem is still there, open terminal in project folder and make

nuget restore <Your-project-or.sln>

Tropin Alexey
  • 606
  • 1
  • 7
  • 16