Receive errors"Object reference not set to an instance of an object"when convert ".docx" to ".pdf"

Hi,friends,Maybe I need your help.

today I get the newest Aspose.Total for .NET,I use Aspose.Word convert “.docx” to “.pdf”,but I received the errors:
Object reference not set to an instance of an object.
at .( , Int32 , ​ , Int32 , Int32 )
at .( )
at .( )
at .()
at .( , Int32 )
at .( )
at .( )
at .( , Int32 )
at .( , Int32 , Boolean )
at .()
at .( , Int32 , Boolean , Boolean )
at . ()
at .( , Int32 )
at .( )
at .()
at .( )
at .(Boolean )
at .()
at ​ .(Document , ​ )
at Aspose.Words.Document.(Boolean )
at .( , )
at . ( )
at Aspose.Words.Document.( , SaveOptions )
at Aspose.Words.Document.(Stream , String , SaveOptions )
at docToPdf.convertPDF.documentToPdf(String ext, String inputName, String outputName).


My codes:
Aspose.Words.Document doc = new Aspose.Words.Document(inputName);
doc.Save(outputName, Aspose.Words.SaveFormat.Pdf);

The “.docx” file is attached.

How to resolve this problem?

Hi Yuan,

Thanks for your inquiry. Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v15.9.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v15.9.0 and let us know how it goes on your side. I hope, this will help.

Hi,Tahir.

I do as you say,the “.doc” document convert to PDF format successful.Thank you very much.

Hi Yuan,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.