Getting java.lang.IndexOutOfBoundsException: Invalid index in Rows indexer: -1 during xml binding

Hi,

I have a requirement where I have to generate a pdf of 10-15 data sections.

My implementaion is : 1) Getting the string (in xml format) from each data section

2) Appending each sections one by one to a StringBuffer

3) Calling pdf.bindXml(fullString).

During bindXml I am getting the exception "java.lang.IndexOutOfBoundsException: Invalid index in Rows indexer: -1" where as I am able to create the individual pdf file if I am creating individually for each data section. All the data are dynamically getting populated.

Please help.

Hello Srinivas,

Thanks for using our products.

Can you please share some sample XML files and the code snippet that you are using so that we can test the scenario at our end. We apologize for your inconvenience.

Hi,
I am using freemarker template to get the xml format and after that pdf.bindxml() and pdf.save are getting executed.

In the freemarker template I am getting the data dynamically and it may contain “-”. So, will it create any issues ?


I have a XML file. I am reading this file and getting the data in a string(which is in xml format) and after that I am writting this in the pdf.

Attaching the XML file.

Snippet :

Pdf pdf = new Pdf();
String medFile = “C:\AsposeTest\config\test\DataInXMLFormat.xml”;
String pdfXml = getContents(new File(medFile));
pdf.bindXML(new StringBufferInputStream(pdfXml.toString()), null);
pdf.save(“C:\AsposeTest\config\test\OutPut.pdf”);
System.out.println(“Aspose PDF is saved successfully”);


Full stack trace what I am getting in exception :
log:messageError in Aspose PDF Generation</log:message>
log:throwablejava.lang.IndexOutOfBoundsException: Invalid index in Rows indexer: -1
at aspose.pdf.Rows.getRow(SourceFile:163)
at aspose.pdf.xml.Acf.a(SourceFile:2719)
at aspose.pdf.xml.Acf.a(SourceFile:1432)
at aspose.pdf.xml.Acg.a(SourceFile:481)
at aspose.pdf.xml.Aca.a(SourceFile:763)
at aspose.pdf.xml.Aaq.a(SourceFile:105)
at aspose.pdf.xml.Aaz.a(SourceFile:112)
at aspose.pdf.Pdf.save(SourceFile:911)

Hello Srinivas,

Thanks for sharing the resource file.

I have tested the scenario and I am able to notice the problem. However in order to figure out the exact reasons of this problem, I need to further investigate it. Please spare us little time and we will get back to you soon. We are sorry for this inconvenience.