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

Free Support Forum - aspose.com

Get "java.lang.ArithmeticException: divide by zero" when calling com.aspose.words.LayoutCollector.getEndPageIndex


Can anyone help with this issue:
A few notes about the issue:

  • Stack trace listed below
  • The issue is very sensitive towards the environment/host server used. It happens in few environments and we are not sure what factor is important.
  • Aspose.Words For Java Version 17.11

Exception Stack Trace:
[err] java.lang.ArithmeticException: divide by zero
[err] at com.aspose.words.zzX.zzZq(Unknown Source)
[err] at com.aspose.words.zzYYM.zzXN(Unknown Source)
[err] at com.aspose.words.zzYYM.zzrC(Unknown Source)
[err] at com.aspose.words.zzYYM.getWidth(Unknown Source)
[err] at com.aspose.words.zzZM0.zzVX(Unknown Source)
[err] at com.aspose.words.zzZM0.zzVY(Unknown Source)
[err] at com.aspose.words.zzZLV.zzW(Unknown Source)
[err] at com.aspose.words.zzZM3.zzS(Unknown Source)
[err] at com.aspose.words.zzZM2.zzZ(Unknown Source)
[err] at com.aspose.words.zzVU.zzZ(Unknown Source)
[err] at com.aspose.words.zzYZ1.zzZ(Unknown Source)
[err] at com.aspose.words.zzXF.zzt3(Unknown Source)
[err] at com.aspose.words.zzXF.zzY(Unknown Source)
[err] at com.aspose.words.zzZ8B.zzZvr(Unknown Source)
[err] at com.aspose.words.zzZ8B.zzT(Unknown Source)
[err] at com.aspose.words.zzZ7N.zzv(Unknown Source)
[err] at com.aspose.words.zzYX3.zzRD(Unknown Source)
[err] at com.aspose.words.zz9B.zzXw(Unknown Source)
[err] at com.aspose.words.zz9C.zz5j(Unknown Source)
[err] at com.aspose.words.zzZN3.zzZ(Unknown Source)
[err] at com.aspose.words.Document.updatePageLayout(Unknown Source)
[err] at com.aspose.words.LayoutCollector.zzZM4(Unknown Source)
[err] at com.aspose.words.LayoutCollector.getEndPageIndex(Unknown Source)

When we call the LayoutCollector.getEndPageIndex() and/or LayoutCollector.getStartPageIndex() methods, we sometimes get that exception above. Does anyone have any idea if the issue may be fixed already? I found this similar post here and the stack had some elements in common updateFields fails with ArithmeticException

We have not been able to check if a newer version of Aspose fixes the issue due to the fact that the issue is only reproducible in some servers. It may take us some time to get the new version of Aspose on the server experiencing the issue. I thought we would check here first. If the issue has been resolved, could you please send us the version that fixed the issue and the ID of the defect.



You are using a very old version of Aspose.Words for Java. We suggest you to please upgrade to the latest version of Aspose.Words for Java as we have resolved many issues since the release of 17.11. We are not sure what might cause this exception in old version. In case you still face the same problem with 19.10, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document you are getting this problem with
  • Please also create a standalone simple Java application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.