We have upgraded from a very old version of Aspose to the latest. Our app was designed around a very specific set of (now obsolete) assumptions to turn a Words object into a Pdf object (example below). This no longer works. It gives me a "XmlException: Data at the root level is invalid. Line 1, position 1." error.
Research seems to indicate this is an obsolete method to save a word file to PDF format. However, that's not how it's being used in this context. It's transforming the Words object and then, later on (not part of this example), using the resulting PDF object to add things like watermarks.
I've been trying to find a way to transfer the contents of the Aspose.Words.Document object into an Aspose.Pdf.Generator.Pdf object, WITHOUT it going into direct mode, but have run out of ideas.
Is this still possible?
NOTE: "doc" is an Aspose.Words.Document object passed into the method.
var p = new Aspose.Pdf.Generator.Pdf();
using (MemoryStream ms = new MemoryStream())
{
doc.Save(ms, Aspose.Words.SaveFormat.Pdf);
p.BindXML(ms, null);
}
p.IsImagesInXmlDeleteNeeded = true;
p.SetUnicode();
p.Save(outputFileName);
return p;
Research seems to indicate this is an obsolete method to save a word file to PDF format. However, that's not how it's being used in this context. It's transforming the Words object and then, later on (not part of this example), using the resulting PDF object to add things like watermarks.
I've been trying to find a way to transfer the contents of the Aspose.Words.Document object into an Aspose.Pdf.Generator.Pdf object, WITHOUT it going into direct mode, but have run out of ideas.
Is this still possible?
NOTE: "doc" is an Aspose.Words.Document object passed into the method.
var p = new Aspose.Pdf.Generator.Pdf();
using (MemoryStream ms = new MemoryStream())
{
doc.Save(ms, Aspose.Words.SaveFormat.Pdf);
p.BindXML(ms, null);
}
p.IsImagesInXmlDeleteNeeded = true;
p.SetUnicode();
p.Save(outputFileName);
return p;