将 libgdiplus 与 IronOCR 结合使用:设置指南
2022年一月19日
更新 2024年十月20日
This article was translated from English: Does it need improvement?
TranslatedView the article in English
.NET Core 需要 libgdiplus 来使用微软的 System.Drawing.Common nuget 包。 如果在MacOS或Linux上未找到,您可能会遇到此异常:
- 未处理的异常。 System.DllNotFoundException:无法通过任何名称找到或加载本机库:[ libgdiplus, libgdiplus.so ]
- 如果您看到 System.TypeInitializationException : “Gdip”的类型初始化程序引发异常,请阅读我们的.NET 6 中的 System.Drawing.Common指南。
Linux
Ubuntu, Debian
apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
Docker
将这行代码添加到 Docker 文件中,它应该会工作。
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
macOS
未处理的异常。 System.DllNotFoundException:无法通过任何名称找到或加载本机库:[ libgdiplus, libgdiplus.dylib ]
- 作为开发人员,您可以将runtime.osx.10.10-x64.CoreCompat.System.Drawing Nuget 包添加到您的 .NET 解决方案中,以将libgdiplus添加到您的项目中。
- 或手动安装
- brew update && brew install mono-libgdiplus
- 更多信息:https://docs.microsoft.com/en-us/dotnet/core/install/macos#libgdiplus