Free Support Forum - aspose.com

Error while saving PDF to XML

Guys,


We are evaluating Aspose.Pdf library (v7.8.0.0) and encountered an error while converting attached PDF file to xml.
We use the following code snippet:
var doc = new Document(@“AsposeError.pdf”);
doc.Save(“Output.xml”, SaveFormat.Xml);

The library throws the error below:
System.NullReferenceException: Object reference not set to an instance of an object.
at Aspose.Pdf.Structure.TextElement.←☻(OperatorCollection , String )
at ♫☻.→.←☻(Element , XmlWriter )
at ♫☻.→.←☻(Element , XmlWriter )
at ♫☻.→.←☻(Document , Stream , XmlSaveOptions )
at Aspose.Pdf.Document.Save(String outputFileName, SaveFormat format)

Could you please take a look?

Hi Alexander,


Thanks for contacting support.

I am afraid the conversion of PDF file to XML format is currently not supported. However for the sake of implementation, we already have logged this requirement in our issue tracking system under New Features list as PDFNEWNET-34332. We will further investigate this requirement in details and will keep you updated on the status of a correction.<o:p></o:p>


We apologize for your inconvenience.


PS, We will consider hiding XML value from SaveFormat enumeration in order to eliminate any confusion.

According to Aspose.PDF product description, it supports bi-directional convertion to\from XML. So, the question is does current version of Aspose.Pdf support the following scenario:

1) Convert existing pdf document into XML.
2) Make some changes in the XML (e.g. fill some data).
3) Convert the XML back to PDF and save it to file.

If so, what API calls do you recommend for convertion to\from XML?

Hi Alexander,


Thanks for your inquiry, As in reference to your first question, you have already reported the issue and Nayyer logged it in our issue tracking system for further investigation and resolution. For remaining questions please check following documentation links for details/code snippet. Hopefully it would address your requirements.


Please feel free to contact us for any further assistance.

Best Regards,