NullPointerException is thrown when document is saved to PDF

We break down an NullPointerException, which is thrown in an customer environment.

java.lang.NullPointerException
at com.aspose.words.zz8S.zzZ(Unknown Source)
at com.aspose.words.zzWE.zzV(Unknown Source)
at com.aspose.words.zzWE.zzZ(Unknown Source)
at com.aspose.words.zzYRC.zzZ(Unknown Source)
at com.aspose.words.zzYRC.zzY(Unknown Source)
at com.aspose.words.zzYWC.zzYE5(Unknown Source)
at com.aspose.words.zzYWC.zzYE7(Unknown Source)
at com.aspose.words.zzYWC.zzY(Unknown Source)
at com.aspose.words.zzYWC.zzZ(Unknown Source)
at com.aspose.words.zzXR.zzcy(Unknown Source)
at com.aspose.words.zzXR.zzW(Unknown Source)
at com.aspose.words.zzXR.zzX(Unknown Source)
at com.aspose.words.zzZ5K.zzG(Unknown Source)
at com.aspose.words.zzZ5K.zzH(Unknown Source)
at com.aspose.words.zzZ5K.zzYT2(Unknown Source)
at com.aspose.words.zzZ5K.zzO(Unknown Source)
at com.aspose.words.zzZ4X.zzG(Unknown Source)
at com.aspose.words.zzYUG.zza(Unknown Source)
at com.aspose.words.zz8R.zzG(Unknown Source)
at com.aspose.words.zz8S.zzZGE(Unknown Source)
at com.aspose.words.zzZ5T.zzZGE(Unknown Source)
at com.aspose.words.zz0S.zzZuq(Unknown Source)
at com.aspose.words.zz0S.zzZut(Unknown Source)
at com.aspose.words.zz0S.zzZ(Unknown Source)
at com.aspose.words.zz0S.zzZ2(Unknown Source)
at com.aspose.words.Document.zzZHK(Unknown Source)
at com.aspose.words.Document.zzZ(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)

We just open the Document and save it to PDF after updatePageLayout. In real the document handling ist much more complex.

24.zip (35.2 KB)

// Open the template document.
Document doc = new Document(path +name+".docx");

// For the changes to be updated to rendered output, UpdatePageLayout must be called again.
// If not called again the appended document will not appear in the output of the next rendering.
doc.updatePageLayout();

doc.save(path + “aspose_”+name+".pdf");

Our Customers get the document and fill the structured document tags. In this case I mean the problem comes from the table in a structured document tag which cannot be page breaked or so.

Aspose.Words for Java (Implementation-Version: 19.11) Version 19.10 also cause this problem.

With versions before this the result is also corrupted, because the optic is not like in word.
aspose_24.pdf (117.0 KB)

@b.schalitz

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2274.

Please note that Aspose.Words for Java is completely auto-ported from .NET, i.e. we do not write code for Aspose.Words for Java; it is generated out automatically from C# code of Aspose.Words for .NET. This issue does not appear while using Aspose.Words for .NET 19.12. The latest version of Aspose.Words for Java 19.12 has not released yet. Hopefully, this issue will be fixed in the next version of Aspose.Words for Java.

You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

After the fix of WORDSJAVA-2274, we will test this case and provide you more information on it.

@b.schalitz

Please use the latest version of Aspose.Words for Java 19.12 to avoid the shared exception. Moreover, there is no issue with layout of output PDF. We have attached the output PDF with this post for your kind reference. 19.12.pdf (119.3 KB)

The issues you have found earlier (filed as WORDSJAVA-2274) have been fixed in this Aspose.Words for .NET 20.1 update and this Aspose.Words for Java 20.1 update.

A post was split to a new topic: NullPointerException is thrown when saving document as PDF