I'm trying to convert a pdf document into svg pages. My first attempt was to load the pdf document and save it as a stream and then load that supposedly converted svg stream as a SVGDocument, this however produces a garbage object.
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, ".");
}
By slightly modifying the code to save the pdf page as a svg image and then loading that as a file stream works perfectly, so I am not sure what is going on here.
Needles to say, I want to try and avoid creating unnecessary files just for the sake of conversion.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…