We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose PDF-to-DOCX - stack overflow and other exceptions

Good day -

We use Aspose PDF to convert PDF to Word format.

There are instances where PDF documents don’t convert, but Aspose does not throw a catchable error. Rather, we seem to get stack overflow errors which are difficult or impossible to handle.

We use ColdFusion but the options are pretty basic:

<cfset var docSaveOptions=createObject(“java”,“com.aspose.pdf.DocSaveOptions”).init()>
<!-- doc: 0, docx: 1 —>
<cfset docSaveOptions.setFormat(1)>
<!— textbox: 0, flow: 1 —>
<cfset docSaveOptions.setMode(1)>
<cfset docSaveOptions.setRecognizeBullets(true)>
<cfset pdf=createObject(“java”,“com.aspose.pdf.Document”).init(tempFile)>
<cfset pdf.save(tempDocXFile,docSaveOptions)>
<cfset pdf.close()>

I’ve attached two PDF documents which cause this error.

These are sent by customers and admittedly they appear to be poorly created, particularly when highlighting blocks of text with the mouse. I don’t necessarily expect Aspose PDF to be able to convert them cleanly (though it would be nice!) but I believe there should be a way to gracefully handle them rather than running out of stack space.

Is there a way that Aspose could detect this issue and throw it before encountering a stack overflow?

Thank you.

Hi Chris,

Thanks for contacting support.

I have tested the scenario using latest release of Aspose.Pdf for Java 10.3.0 in Eclipse Juno project running over Windows 7 (x64) with JDK 1.7 and I am unable to notice any issue. As per my observations, the PDF files are properly being converted to DOCX format. Can you please try using the latest release and share your findings.

For your reference, I have also attached the resultant files generated over my end.

Thank you for running this Nayyer.

I just upgraded Aspose 10.3.0 from the previous version. It appears as though you may have run the examples in textbox mode. I am now able to convert using textbox mode; however, our customers require that flow be maintained, so we have flow mode set:


Are you also able to convert using flow mode? When I run one of the documents, it does so without creating a stack overflow error; however the text is all over the place. I’ve attached the document to this message.

Thanks again.

Hi Chris,

Thanks for sharing the details.

I have again tested the scenario and have observed that when trying to convert badpdf3.pdf to DOCX format with Flow mode, an OutOfMemoryError is being generated. For the sake of correction, I have logged it in
our issue tracking system as PDFNEWJAVA-34888. However when badpdf2.pdf is converted to DOCX format, there are formatting issues in resultant file. For
the sake of correction, I have separately logged it in our issue tracking system as PDFNEWJAVA-34889. We
will investigate these issues in details and will keep you updated on the status
of a correction.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFJAVA-34888) have been fixed in Aspose.Pdf for Java 17.3.0 Release Notes.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.