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

Free Support Forum - aspose.com

Aspose.Words Document.SaveToPdf() Null refrerence exception

Using Aspose.Words in the SaveToPdf() method I’m getting a NullReferenceException with the attached doucment

Source code:

Document d = new Document (sourcePath);


System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
at ?.?.?(Node ?)
at ?.?.?()
at ?.?.?()
at ?.?.?(Document ?, ? ?)
at Aspose.Words.Document.SaveToPdf(String fileName)
at AsposeTestConversion.Form1.button1_Click(Object sender, EventArgs e) in C:\dev\AsposeTestConversion\AsposeTestConversion\Form1.cs:line 23

Thanks for your request. I managed to reproduce the problem and created new issue #7173 in our defect database. I will notify you as soon as it is fixed.
The problem occurs only if you are using Aspose.Words in evaluation mode. The document is converted without problems when using the licensed version of Aspose.Words.
You can request 30-days temporary license to test Aspose.Words without evaluation limitations.
Best regards.

The problem is due to Aspose.Words evaluation mode cutting a document at about 200 paragraphs or so and that boundary is inside a huge table of contents field at the beginning of the document. The resulting document is invalid (an incomplete field) and therefore rendering fails in evaluation mode. As a workaround please use a tempoary license. In the meantime I will see if that can be fixed.

The issues you have found earlier (filed as 7173) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by alexey.noskov.