NullPointerException when saving doc to pdf

When saving the attached document to pdf we get a NullPointerException. What’s wrong with that document?

The code:

import com.aspose.words.Document;

public class ErrorSavingPdf {
public static void main(String[] args) throws Exception {
Document doc = new Document("c:/tmp/aspose/aspose-error.doc");
doc.save("c:/tmp/aspose/aspose-error.pdf");
}
}

The Stacktrace:

Exception in thread "main" java.lang.NullPointerException
 at com.aspose.words.qk.ex(FloaterFrame.java:252)
 at com.aspose.words.qk.jr(FloaterFrame.java:211)
 at com.aspose.words.qk.Gn(FloaterFrame.java:63)
 at com.aspose.words.asq.a(ShellPart.java:127)
 at com.aspose.words.asr.asY(ShellReflower.java:291)
 at com.aspose.words.asr.a(ShellReflower.java:59)
 at com.aspose.words.cg.BJ(ColumnReflower.java:194)
 at com.aspose.words.cg.c(ColumnReflower.java:39)
 at com.aspose.words.ajt.p(PageReflower.java:109)
 at com.aspose.words.ajt.h(PageReflower.java:52)
 at com.aspose.words.aki.w(PartReflower.java:31)
 at com.aspose.words.aub.fq(StoryLayout.java:95)
 at com.aspose.words.fj.aC(DocumentLayoutBuilder.java:165)
 at com.aspose.words.fi.Gn(DocumentLayout.java:215)
 at com.aspose.words.wv.a(LayoutDocument.java:51)
 at com.aspose.words.Document.updatePageLayout(Document.java:1468)
 at com.aspose.words.Document.ay(Document.java:1407)
 at com.aspose.words.Document.FI(Document.java:1420)
 at com.aspose.words.Document.getPageCount(Document.java:1449)
 at com.aspose.words.qh.a(FixedPageWriterBase.java:23)
 at com.aspose.words.Document.a(Document.java:1360)
 at com.aspose.words.Document.save(Document.java:753)
 at com.aspose.words.Document.save(Document.java:708)

Sorry, I forgot: my aspose version is 11.0.0

Hi
Jens,

Thanks for your inquiry.

While using the latest version of Aspose.Words for Java i.e. 11.3.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to Aspose.Words v11.3.0.

I hope, this will help.

Best Regards,

Yes, thanks, 11.3.0 fixes the issue.

Hi Jens,

Thanks for your feedback. It is perfect that the latest version of Aspose.Words resolves the problem. Please let us know any time you have any further queries. We are always glad to help you.

Best Regards,