Free Support Forum - aspose.com

Aspose.word --> xml then aspose.fdf --> pdf

I have my own doc and would like to use aspose.word to convert it to xml (aspose format) then I modify the xml files (insert data from sql server) and convert it to pdf (by aspose.pdf).

I just have the demo aspose.word but the formatxml is not available (while the aspose.com is saying this feature is there).

Do I miss something? Any help would be appriciated.

Thanks,

Don

Here is a complete code that performs the conversion:

Document doc = new Document(filename);

// save the document in Aspose.Pdf.Xml format into a memory stream.

MemoryStream stream = new MemoryStream();

doc.Save(stream, SaveFormat.FormatAsposePdf);

// seek to the beginning so it can be read by XmlDocument.

stream.Seek(0, SeekOrigin.Begin);

// load the document into an XmlDocument

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.Load(stream);

// load the XML document into Aspose.Pdf

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

// make sure the images that were saved by Aspose.Word into Windows temporary

// folder are automatically deleted by Aspose.Pdf when they are no longer needed.

pdf.IsImagesInXmlDeleteNeeded = true;

pdf.BindXML(xmlDoc, null);

// cache true type fonts to increase speed

pdf.IsTruetypeFontMapCached = true;

pdf.TruetypeFontMapPath = Path.GetTempPath();

// now produce the PDF file.

pdf.Save(System.IO.Path.GetFileNameWithoutExtension(filename) + ".pdf");

As you can see the format type to save as document as Xml for Pdf is actually called:

SaveFormat.FormatAsposePdf