Update all Fields in DOCX & Save Word Document to PDF using Java | Avoid java.lang.NullPointerException

During the saving of the added Word file, Aspose throws a nullpointer exception
Below is the stacktrace

Regards,
Inception

generatePdfPreview[100]: Error generating PDF preview
java.lang.NullPointerException at com.aspose.words.zzZBV.isVisible(Unknown Source)
at com.aspose.words.zzZBZ.zzYWI(Unknown Source)
at com.aspose.words.zzZBX.zzZ(Unknown Source)
at com.aspose.words.zzXI.zza8(Unknown Source)
at com.aspose.words.zzXI.zza9(Unknown Source)
at com.aspose.words.zzXI.zzW(Unknown Source)
at com.aspose.words.zzXI.zzX(Unknown Source)
at com.aspose.words.zzZ47.zzB(Unknown Source)
at com.aspose.words.zzZ47.zzC(Unknown Source)
at com.aspose.words.zzZ47.zzYNS(Unknown Source)
at com.aspose.words.zzZ47.zzL(Unknown Source)
at com.aspose.words.zzZ3J.zzI(Unknown Source)
at com.aspose.words.zzYSR.zz9(Unknown Source)
at com.aspose.words.zz8A.zzI(Unknown Source)
at com.aspose.words.zz8B.zzZDJ(Unknown Source)
at com.aspose.words.zzZ4C.zzZDJ(Unknown Source)
at com.aspose.words.zzZZU.zzZrb(Unknown Source)
at com.aspose.words.zzZZU.zzZre(Unknown Source)
at com.aspose.words.zzZZU.zzZ(Unknown Source)
at com.aspose.words.zzZZU.zzYW(Unknown Source)
at com.aspose.words.Document.zzZEY(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.inception.ms.officeconverter.core.WordPreviewGenerator.generatePdfPreview(WordPreviewGenerator.java:234)
at com.inception.ms.officeconverter.core.WordPreviewGenerator.generatePdfPreviews(WordPreviewGenerator.java:100)document.zip (2.2 MB)

@inceptionEhv,

Saving your DOCX Word document to PDF format after updating the Fields causes a java.lang.NullPointerException on our end:

Document doc = new Document("C:\\Temp\\document\\Nullpointer exception.docx");
doc.updateFields();
doc.save("C:\\temp\\document\\awjava-20.9.pdf");

For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-21121. 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.

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