Free Support Forum - aspose.com

Not able to format the html tag while converting to pdf

Hi,

I have a xml file from which I am generating the PDF. The xml is dynamic and it contains a field which can be html data. So, i made it to IsHtmlTagSupported=true.

The data is :

Test <and> , &

 

 

 

Test

 

Test

While generating the PDF i am getting the following exception :

org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.

AsposeDelegate Error in main

[Fatal Error] :1:1757: The entity "nbsp" was referenced, but not declared.

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:1565)

at ReadFromFile.generatePdfDataSections(ReadFromFile.java:105)

at ReadFromFile.main(ReadFromFile.java:121)

The code template is :

Pdf pdf = new Pdf();

String inputFile = "C:\\Documents and Settings\\Desktop\\testing.txt";

String data = readFile(new File(inputFile));

pdf.bindXML(new StringBufferInputStream(data), null);

pdf.save("C:\\AsposeTest\\config\\test\\My_TEST_PDF_12.pdf");

Attaching the testing.txt

Aspose Java Version 2.7.0/2.9.0 (tried in both)

Actually its failing if the text contains &, < ,   characters and IsHtmlTagSupported=true;

Please help.

Hello Sriman,

Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFJAVA-28853. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.