duy*_*yen 3 aspose.pdf .net-core
我正在 Mac (Catalina) 上运行 Dotnet 核心应用程序 (3.1),并且我\xe2\x80\x99m 尝试通过本教程使用 Aspose PDF 将图像添加到 PDF: https: //docs.aspose.com/pdf /net/manipulate-images/ .
\n尝试添加 imageStream 时出现错误。
\n\n\n“图像流无效(\xe2\x80\x98Gdip\xe2\x80\x99 的类型初始值设定项引发\n异常。)\xe2\x80\x99。
\n
var logoFile = "logo.jpg";\nFileStream imageStream = new FileStream(logoFile, FileMode.Open, FileAccess.Read);\npage.Resources.Images.Add(imageStream); //Error on this line\nRun Code Online (Sandbox Code Playgroud)\n经过我的研究,这似乎与需要libgdiplus库有关。我安装了这个,brew install mono-libgdiplus但仍然收到此错误。
可以复制该问题的示例项目:https://github.com/duyn9uyen/aspose-add-image-to-pdf。
\nAspose.Pdf:版本=\xe2\x80\x9c20.3.0\xe2\x80\x9d。
\n有人可以帮忙吗?
\nduy*_*yen 11
需要安装libgdiplus. https://learn.microsoft.com/en-us/dotnet/core/install/macos
brew update
brew install mono-libgdiplus
Run Code Online (Sandbox Code Playgroud)
需要CoreCompat.System.Drawing从https://github.com/CoreCompat/CoreCompatdotnet安装。在您runtime.osx.10.10-x64.CoreCompat.System.Drawing --version 5.8.64的 . csproj文件。
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3725 次 |
| 最近记录: |