XML to PDF conversion

Hi,

I am trying to convert XML to PDF file.

I have files under My folder structure is d:/PDF

d:/PDF/ConvertXML.java and d:/PDF/template.xml

And have aspose-pdf-2.8.0-jdk16.jar in the classpath.

When I am running the program I am getting following exception.

What am I doing wrong here?

My java program:

Pdf pdf = new Pdf();
pdf.bindXML("D:/PDF/SalesByCategory.xml", null);
pdf.save("d:/temp/pdfHolder/xmlDoc.pdf");

Exception:

[Fatal Error] :1:8: The processing instruction target matching "[xX][mM][lL]" is not allowed.
java.lang.NullPointerException
at aspose.pdf.xml.Aba.a(SourceFile:180)
at aspose.pdf.xml.Aba.a(SourceFile:159)
at aspose.pdf.Pdf.bindXML(SourceFile:1588)
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
null

Thanks

Mamatha

Hi Mamatha,

Thanks for using our products.

I have tested the scenario while using Aspose.Pdf for Java 3.0.1 and I am unable to notice any problem. The XML file is properly being converted into PDF format. Can you please try using the new release version and in case you still encounter any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

For your reference, I have also attached the resultant PDF document that I have generated. Please take a look.

Hi,

I was able to finally convert XML to PDF file. My XML file had a space infront of XML declaration. Once I removed it it worked.

Thanks

Mamatha

Hi Mamatha,

I am pleased to hear that the problem regarding XML to PDF conversion is resolved. In case I can be of any further assistance, please feel free to contact.