Bur*_*rak 1 .net itext .net-core itext7 .net-core-3.1
IText7 Version : 7.1.14我们检测到无法在 .NET 5 中使用 IText7:
private byte[] BuildPDF()
{
using(var stream = new MemoryStream())
{
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(stream));
Document doc = new Document(pdfDoc);
Table table = new Table(UnitValue.CreatePercentArray(8)).UseAllAvailableWidth();
for (int i = 0; i < 16; i++)
{
table.AddCell("hi");
}
doc.Add(table);
doc.Close();
return stream.ToArray();
}
}
Run Code Online (Sandbox Code Playgroud)
这个简单的代码适用于 .NET Core 3.1 项目,但不适用于.NET 5 项目。
抛出Exception如下:
An unhandled exception occurred while processing the request.
FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.PlatformAbstractions,
Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The system cannot find the file specified.
iText.IO.Util.ResourceUtil.LoadITextResourceAssemblies()
TypeInitializationException: The type initializer for 'iText.IO.Util.ResourceUtil' threw an exception.
iText.IO.Font.Type1Parser.GetMetricsFile()
Run Code Online (Sandbox Code Playgroud)
找不到 .dll,但如何解决这个问题或如何向 IText7 提交错误报告?
小智 5
您可以从上述链接或从项目解决方案上的“管理 Nuget 包”手动安装https://www.nuget.org/packages/Microsoft.DotNet.PlatformAbstractions/ (Microsoft.DotNet.PlatformAbstractions) 数据包。
| 归档时间: |
|
| 查看次数: |
978 次 |
| 最近记录: |