linux - HiQPdf 无法获取正在执行的程序集目录

当我尝试在 Linux 上使用 HiQPdf 将 html 转换为 PDF 时(在 Windows 上工作正常)我收到此错误:

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)

最佳答案

现在它从 .NET Core 开始在 Linux 上运行。 首先你必须摆脱System.Drawing.Common在你的代码中因为现在 it's only supported on Windows .您可以使用 ImageSharp , SkiaSharp或 Microsoft.Maui.Graphics反而。它们都是跨平台的。

然后,安装libgdiplus .

在 Ubuntu 上: sudo apt-get install -y libgdiplus

在 macO 上(您的系统中必须安装 homebrew): brew install mono-libgdiplus

重启 Nginx 服务器: sudo systemctl restart nginx

如果问题仍然存在,在项目文件夹中打开终端并制作

nuget restore <Your-project-or.sln>

https://stackoverflow.com/questions/60266924/

相关文章:

css - 如何在不破坏所有内容的情况下 stub Sprockets 4 中的 Assets ?

python - 加速 Python 中的循环

r - 尝试写入或绘制光栅时 .local(object, ...) 出错

ruby - RSpec Mock - 类未实现实例方法 : jql. 也许您打算改用 `class

google-cloud-automl - AutoML 视觉 : Error: ImportDat

python - 如何在 TensorFlow 2 中保存/加载模型的一部分?

node.js - 谷歌 API + Passport + react : Authenticati

javascript - Vue.js 清除用户缓存

php - 无服务器框架,处理程序不存在

pytorch - 在 Pytorch tensorboard 中绘制几张图