We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Xml to PDF - Succeeds in Generator- fails in Document


I have an Xml file (XmlFile1.xml) which produces a valid PDF when I use the Pdf Generator BindXML method and saving. But I read that the Generator is old and we should use the Document API instead.
When I use the Document BindXml method, the call succeeds but the generated PDF (PdfFromXmlTest.pdf) cannot be opened. (Invalid PDF).
Please advice what the correct XML schema is for using the Document BindXml method to generate a PDF.

Thank you.

Hi Morten,

Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for .NET 11.0.0 and unable to notice reported issue. Please download and try latest release of Aspose.Pdf for .NET, it will resolve the issue.

XmlLoadOptions options = new XmlLoadOptions();<o:p></o:p>

// load xml file

Document pdfDocument = new Document(myDir + "XMLFile1.xml", options);

pdfDocument.Save(myDir + "XMLtoPDF_DOM.pdf");

Please feel free to contact us for any further assistance.

Best Regards,

Thank you.

Loading the Xml in the constructor works. So apparently the only problem is to bind a full XML definition in the BindXml method.


Hi Morten,

Thanks for sharing the feedback.

Both namespaces have separate approach for loading and converting XML files to PDF document. So when using new DOM approach, you need to load XML file into XmlLoadOptions object. In the event of any further query, please feel free to contact.