【发布时间】:2021-01-12 19:59:28
【问题描述】:
我正在尝试将 pdf 文档转换为 svg 页面。我的第一次尝试是加载 pdf 文档并将其保存为流,然后将假定转换的 svg 流加载为 SVGDocument,但这会产生一个垃圾对象。
pageDocument.Save(ms, SaveFormat.Svg);
pageDocument.Save("temp.svg", SaveFormat.Svg);
// Object is invalid
var svgDocument1 = new SVGDocument(ms, ".");
// Create a FileStream object
using (var stream = new FileStream("temp.svg", FileMode.Open, FileAccess.Read))
{
// Valid object
var svgDocument2 = new SVGDocument(stream, ".");
}
通过稍微修改代码以将 pdf 页面保存为 svg 图像,然后将其作为文件流加载,效果很好,所以我不确定这里发生了什么。
需要说,我想尽量避免仅仅为了转换而创建不必要的文件。
【问题讨论】:
标签: c# .net aspose .net-standard-2.0