Saving doc as pdf getting "Object Null Reference" Exception

When Saving a document to pdf, I am getting an “Object Reference not set to instance of an Object” exception.

doc.Save(pdfFileName, SaveFormat.Pdf);

Hello

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Best regards,

Is there a way to change the document to get rid of the exception?

Hi

Thanks for your request. It seems the problem occurs because there is a field in your document without FieldEnd. See the last QUOTE field in your document. So you can remove or reinsert this field to resolve the issue.
Best regards.

Can you give me an example of how to find the missing information in the document?

Hi

Thanks for your request. You can use DocumentExplorer (Aspose.Words demo application) to inspect structure of your documents. After installing Aspose.Words, you can find this demo in the following folder:
C:\Program Files\Aspose\Aspose.Words\Demos
Hope this helps.
Best regards.

I am getting the same exception error when saving as a pdf with the following document, but it looks like all of the tags are present?

PdfOptions p = new PdfOptions();
p.IsEmbedTrueTypeFontsForAsciiChars = false;
doc.SaveToPdf(0, doc.PageCount, workFileName, p);

Hi

Thank you for additional information. I managed to reproduce this problem on my side. Your request has been linked to the appropriate issues. You will be notified as soon as it is resolved.
The problem occurs because there is an invalid field in the latest paragraphs. There is only FieldSart and FieldEnd, but there is no field code.
Best regards.

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

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(4)

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

This message was posted using Notification2Forum from Downloads module by aspose.notifier.