Free Support Forum - aspose.com

Word to PDF ->[NullReferenceException: Object reference not set to an instance of an object.]

We are looking at using Aspose.Word and Aspose.PDF for a project. I took over the project, and inherited both code and word documents. My predecessor was able to generate the PDF from a word document, however, whenever I try, using the same code and doc file, I get a Null Reference Exception on the pdf.save method. It seems to create the xml document fine and in full, for some reason it won't convert the xml to Pdf
Any ideas why?
The document is attached.

Thank you for your help.

Hi,

Thank you for considering Aspose.

Please download the latest hotfix of Aspose.Word and Aspose.Pdf and try again.

This did not help. I still get the same error. I downloaded and installed Aspose.Word from 6/30 and Aspose.PDF from 6/9, both of which were the most recent Hotfixes listed.

Here’s the error message:
NullReferenceException: Object reference not set to an instance of an object.]
x3f91538e8c0de749.x8df46aaf181a62d1.x37bb51321f85ddf3(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, Table x1ec770899c98a268, Row xa806b754814b9ae0, Cell xe6de5e5fa2d44af5, Text xb41faee6912a2313, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de)
x3f91538e8c0de749.x44928f367a7563fb.xd22cb714335f8d2c(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, Table x1ec770899c98a268, Row xa806b754814b9ae0, Cell xe6de5e5fa2d44af5, Text xb41faee6912a2313, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de, Boolean x70e701cee22724e3)
x3f91538e8c0de749.x7576dadd7c449efa.x8810991188d773db(Pdf x6beba47238e0ade6, Section xb32f8dd719a105db, x33eef31791ddfc27 xb4012f98512a2f3d)
x3f91538e8c0de749.x6a7cd842e95518d7.xc5e548c04b18e6e2(Pdf x6beba47238e0ade6)
x3f91538e8c0de749.xaa36f84dba9d652f.x5ec1518f85fc1bbf(xb912e9429339cb81 x80010f902a1f736e, Pdf x6beba47238e0ade6)
Aspose.Pdf.Pdf.Save(String fileName, SaveType saveType, HttpResponse response)
Web_PDF.Viewer.SendToBrowserAsPdf(Document doc) in C:\Inetpub\wwwroot\Web_PDF\Viewer.aspx.vb:131
Web_PDF.Viewer.SendToBrowser(Document doc, String outputFormat) in C:\Inetpub\wwwroot\Web_PDF\Viewer.aspx.vb:95
Web_PDF.Viewer.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Web_PDF\Viewer.aspx.vb:65
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +744

It turns out the problem was that I had the apsose.PDF referenced from the PDF component instead of the Aspose.PDF from the Word component. What’s the difference between these? Do I need to buy the PDF component if I’m not referencing it in my project?



Thanks

Hi parsonsje,

Thank you for considering Aspose.

The Aspose.Word includes a Aspose.Pdf dll used for it's demos. That dll is not the latest version of Aspose.Pdf. You'd better download the latest version of Aspose.Pdf if you want to use it. Certainly you need not buy it if you don't reference it in your project.

Why can I get a PDF to generate with one dll and not the other? Both Aspose.PDF.dlls are version 2.2.8.0. If I use the dll included with the PDF component I still get the Null reference, for which I still have no explanation.

Dear parsonsje,

Thank you for considering Aspose.

Sorry for making you confused. I have published a wrong dll and then updated with the correct one. Now please use the new version 2.3.