Converting Word File from DOCX to PDF using Java | Avoid Infinite Loop or Hang | Performance Improvement

In our application Aspose Words Java 20.5 hangs when converting a specific client document from DOCX to PDF.

Here is the stacktrace:

        at com.aspose.words.internal.zzV7.zzT(Unknown Source)
        at com.aspose.words.internal.zzV7.zzV2(Unknown Source)
        at com.aspose.words.internal.zzV7.zzV7(Unknown Source)
        at com.aspose.words.internal.zzV7.zzZ(Unknown Source)
        at com.aspose.words.internal.zzV7.zzZ(Unknown Source)
        at com.aspose.words.zzGN.zzZ(Unknown Source)
        at com.aspose.words.zzYPW.zzZ(Unknown Source)
        at com.aspose.words.zzYPW.zzZ(Unknown Source)
        at com.aspose.words.zzYPW.zzZ(Unknown Source)
        at com.aspose.words.zzZYU.zzZ(Unknown Source)
        at com.aspose.words.zzZYU.zzZ(Unknown Source)
        at com.aspose.words.zzYPW.zzZ6(Unknown Source)
        at com.aspose.words.zzYPW.zzX(Unknown Source)
        at com.aspose.words.zzYUZ.zzYza(Unknown Source)
        at com.aspose.words.zzYUZ.zzYzc(Unknown Source)
        at com.aspose.words.zzYUZ.zzY(Unknown Source)
        at com.aspose.words.zzYUZ.zzZ(Unknown Source)
        at com.aspose.words.zzXI.zzav(Unknown Source)
        at com.aspose.words.zzXI.zzW(Unknown Source)
        at com.aspose.words.zzXI.zzX(Unknown Source)
        at com.aspose.words.zzZ4G.zzB(Unknown Source)
        at com.aspose.words.zzZ4G.zzC(Unknown Source)
        at com.aspose.words.zzZ4G.zzYOC(Unknown Source)
        at com.aspose.words.zzZ4G.zzL(Unknown Source)
        at com.aspose.words.zzZ3S.zzI(Unknown Source)
        at com.aspose.words.zzYT0.zz9(Unknown Source)
        at com.aspose.words.zz8E.zzI(Unknown Source)
        at com.aspose.words.zz8F.zzZE3(Unknown Source)
        at com.aspose.words.zzZ4L.zzYOV(Unknown Source)
        at com.aspose.words.Document.updatePageLayout(Unknown Source)
        at com.aspose.words.zz35.zzZxF(Unknown Source)
        at com.aspose.words.zz36.zzF2(Unknown Source)
        at com.aspose.words.zzZZY.zzXU(Unknown Source)
        at com.aspose.words.zzZZY.zzZ(Unknown Source)
        at com.aspose.words.zzZZY.zzYW(Unknown Source)
        at com.aspose.words.Document.zzZFi(Unknown Source)
        at com.aspose.words.Document.zzY(Unknown Source)
        at com.aspose.words.Document.zzZ(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)

What could be causing DOCX to PDF to hang at that point? The code is obfuscated so I can not troubleshoot it on my end.

@RyanWilliamsUSC,

Please upgrade to the latest (20.10) version of Aspose.Words for Java and see how it goes on your end? In case the problem still remains, then please ZIP and upload your input Word DOCX document (you are getting this problem with) here for testing. We will then investigate the issue on our end and provide you more information.

@awais.hafeez,

Thanks for your help.

We have updated to Aspose Words 20.10 for Java and the problem is still present.

I managed to get access to the file that causes this. I can not share the file with you or anyone else because of privacy laws in my country but I can share what causes this issue.

In the file there are 3 images side by side on a page. 2 of the images are anchored inline with text. The third image is anchored square. The third image has part in the margin. When changing the position of the third image in MS Word the middle image is moved to the next page. If i anchor this third image inline and adjust the size slightly it fits next to the other images and Aspose converts it correctly.

Given this I am sure this image being anchored that way it is with the other 2 images inline on the page with it is causing Aspose to enter this infinite loop.

For now we had the user update the third image in the file and
Aspose works fine. We would still like to help patch the bug that caused this.

I have been unlucky with generating a file that also has this issue that I can send you.If i mange to do it I will send you the file.

@RyanWilliamsUSC,

Unfortunately, it is difficult to say what the problem is without the document. We need your document to be able to reproduce the exact problem on our end. Please note that it is safe to attach files in the forum. If you attach your files here, then only you and Aspose staff members can download them. You can also remove any sensitive information by replacing it with dummy data instead. We will be able to start investigation into your scenario as soon as you provide required document to reproduce.

@awais.hafeez

I managed to reproduce this issue in MS Word using formatting info from a client document but synthetic data. I am waiting for approval to share this clean file. I will upload the file when i get the approval to do so.

@awais.hafeez

Here is a file that causes this issue with DOCX to PDF.

Sample1-1.zip (436.0 KB)

@RyanWilliamsUSC,

We have logged this problem in our issue tracking system with ID WORDSNET-21400. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@awais.hafeez

We have experienced this same bug on some of our other documents from our users. I am wondering if you have any ETA or status on WORDSNET-21400 that I can pass to my leadership?

@RyanWilliamsUSC,

We have completed the analysis of WORDSNET-21400; but, there are no timelines (ETA) available at the moment. We will keep you posted here on any further updates and let you know when this issue will get resolved in future. We apologize for your inconvenience.

Please also ZIP and upload the other Word document(s) you are getting this problem with here for testing. We will then investigate the issues with these documents as well and provide you more information.

The issues you have found earlier (filed as WORDSNET-21400) have been fixed in this Aspose.Words for .NET 21.4 update and this Aspose.Words for Java 21.4 update.