使用Aspose.Slides把ppt转换成pdf问题的解决,丢失文本和报IBM437字符集问题

最近升级一个旧的系统的文档转换,老系统采用.NET5.0开发,Aspose.Slides的版本是18.9,需要升级到25.4。直接替换到dll后,出现了如下两个问题。

问题一:System.ArgumentException:“'IBM437' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Arg_ParamName_Name”

这是因为在.NET 5中,许多传统的编码是默认不包含的,需要手动启用。添加System.Text.Encoding.CodePages的包引用。然后在Main方法中添加:

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

问题二:解决上述问题后,能够实现ppt的转换,但是导出的pdf,图片元素还在,所有文字都缺失了,所有的ppt打开都没我问题,字体也都安装了。跟踪调试ppt的所有slides里面的TextFrame也未发现异常。我想可能是版本兼容的问题,就用.NET 8试了一下,发现是可以的。在NuGet包管理器里面发现25.4确实不支持.NET 5.0了,

以后引用第三方插件还是通过NuGet包管理器去引用,尽量避免直接引用dll。

问题三:Unable to load DLL 'libSkiaSharp' or one of its dependencies: 找不到指定的模块。 (0x8007007E)

Aspose.Cells25.4报上述错误。SkiaSharp版本的问题。通过NuGet包安装默认安装的是3.119.0版本,

在Aspose官方网站上看到这样的描述

https://docs.aspose.com/cells/zh/net/how-to-run-aspose-cells-for-net6/

image

 

posted @ 2025-07-19 13:58  shunliy  阅读(143)  评论(0)    收藏  举报