Hi support team,
appreciate your help to support the below error, that was shown when trying to save PDF to .docx thru the DocSaveOptions method.
Note: The source working with library aspose-pdf-20.8.jar but it starts not working from 20.9 and above.
Error Meessage:
Exception in thread “Thread-2” java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:424)
at java.util.ArrayList.get(ArrayList.java:437)
at com.aspose.pdf.internal.l0j.ly.lf(Unknown Source)
at com.aspose.pdf.internal.l0j.ly.lI(Unknown Source)
at com.aspose.pdf.internal.doc.ml.MlParagraphConverter.addParagraph(Unknown Source)
at com.aspose.pdf.internal.l99l.lk.lI(Unknown Source)
at com.aspose.pdf.internal.l99l.lk.lt(Unknown Source)
at com.aspose.pdf.internal.l0j.lf.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Exception in thread “main” class com.aspose.pdf.exceptions.PdfException: java.lang.ArrayIndexOutOfBoundsException: -1
com.aspose.pdf.l4j.lI(Unknown Source)
com.aspose.pdf.l4j.lI(Unknown Source)
com.aspose.pdf.ADocument.lj(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.Document.lI(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source
Source Code:
public void ConvertPDFToDocx(String input , String output) { String originalPath = input; String currentPath = output; com.aspose.pdf.Document doc = new com.aspose.pdf.Document(originalPath); // Instantiate DocSaveOptions instance DocSaveOptions saveOptions = new DocSaveOptions(); // Set output format saveOptions.setFormat(DocSaveOptions.DocFormat.DocX); // Set the recognition mode as Flow saveOptions.setMode(DocSaveOptions.RecognitionMode.Flow); saveOptions.setAddReturnToLineEnd(false); saveOptions.setCloseResponse(false); // Save resultant DOCX file doc.save(currentPath, saveOptions); }
Thanks
Lee