In the attached project I get a “System.NullReferenceException was unhandled” when saving a Word document as a PDF. This works fine in Aspose.Words 9.4.1.
The stack trace is…
System.NullReferenceException was unhandled
Message = "Object reference not set to an instance of an object."
Source = "Aspose.Words"
StackTrace:
at xfbd1009a0cbb9842.x4724ed988e1000da.x1f490eac106aee12()
at xfbd1009a0cbb9842.x4724ed988e1000da.x20aee281977480cf(FieldStart x10aaa7cdfa38f254, FieldSeparator x3de314ab70bbd9bf, FieldEnd xca09b6c2b5b18485)
at xfbd1009a0cbb9842.x3759c06a3a4cf5d1.x43fef3435fba7a66(FieldStart x10aaa7cdfa38f254, FieldSeparator x3de314ab70bbd9bf, FieldEnd xca09b6c2b5b18485)
at x4adf554d20d941a6.x5c28fdcd27dee7d9.get_xd1b40af56a8385d4()
at x4adf554d20d941a6.x5c28fdcd27dee7d9.x3e04636bf524a4cf(xb9e48f11d7f06ec9 x27f5ecb735ac9676)
at x4adf554d20d941a6.xf0b374f4c0172a4c.x57b3c9e650685d36(x56410a8dd70087c5 x5906905c888d3d98, x56410a8dd70087c5 x62584df2cb5d40dd, x56410a8dd70087c5 x0e990edf4549ee50, Boolean xa17853d20c8c42bd, Boolean x4d2b4f056cf5bb8b)
at x4adf554d20d941a6.xf0b374f4c0172a4c.xf067dcd5f2631e2c(x56410a8dd70087c5 x5906905c888d3d98, Boolean xa17853d20c8c42bd)
at x4adf554d20d941a6.xf0b374f4c0172a4c.xcd61e66a5417dbee(x56410a8dd70087c5 x5906905c888d3d98, Boolean x2718ffc1fa17413a)
at x4adf554d20d941a6.x6d3ade29d016f4ea.x5f6867bc5a977cb1()
at x4adf554d20d941a6.x6d3ade29d016f4ea.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199, Boolean xcbd8250c1cb0998d)
at x4adf554d20d941a6.x20de8d9377d7de69.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199)
at x4adf554d20d941a6.x09e62a55cab70965.x5de571cf1cd1652c(xf6937c72cebe4ad1 x311e7a92306d7199)
at x4adf554d20d941a6.x09e62a55cab70965.x05220cdc6b4425eb()
at x4adf554d20d941a6.x09e62a55cab70965.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199, Int32 xcd3a9f82634fe5f9)
at x4adf554d20d941a6.x71da84fff8849445.xc3819e13f60dd8e6(x53cb1139c5c64ee6 xd7e5673853e47af4, Int32 xcd3a9f82634fe5f9, Boolean x3175070523842c98)
at x4adf554d20d941a6.x4ddd0723770f9758.xb1e18d74ac7e1b23()
at x4adf554d20d941a6.x4ddd0723770f9758.xb47a6df2eae4ba51()
at x4adf554d20d941a6.x4ddd0723770f9758.xc3819e13f60dd8e6(x3d1ad8ce75f0db3a xd3311d815ca25f02, Int32 xd284dd7d525c5491, Boolean x3175070523842c98, Boolean x4097fa47409be495)
at x4adf554d20d941a6.x3f7228e953be72ed.xd79114a9e7bc0d9e()
at x4adf554d20d941a6.x3f7228e953be72ed.xc3819e13f60dd8e6(x852fe8bb5ac31098 xe3e287548b3d01f5, Int32 xd284dd7d525c5491)
at x4adf554d20d941a6.x4af2add38e634ad4.xcbc2273143eac9ec(x852fe8bb5ac31098 xb6842aa1e60562e1)
at x4adf554d20d941a6.x4af2add38e634ad4.xc3819e13f60dd8e6(xc7f90d9c7c51cede xbbe2f7d7c86e0379)
at x4adf554d20d941a6.xea876d525d28ff96.xc3819e13f60dd8e6(x398b3bd0acd94b61 xd7e5673853e47af4)
at x4adf554d20d941a6.xac6c82c74ce247fb.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b)
at x4adf554d20d941a6.xeefdffd909e695da.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b)
at x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
at Aspose.Words.Document.UpdatePageLayout()
at Aspose.Words.Document.x410db0f4a89a6ef1(Boolean x24af0daafcd8fb8c)
at Aspose.Words.Document.get_xcde671c53995c411()
at Aspose.Words.Document.get_PageCount()
at xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
at Aspose.Words.Document.Save(String fileName, SaveFormat saveFormat)
at SaveAsPDFError.Form1.button1_Click(Object sender, EventArgs e) in D:\Users\shinks\Documents\Visual Studio 2008\Projects\SaveAsPDFError\SaveAsPDFError\Form1.cs:line 28
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message & m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message & m)
at System.Windows.Forms.ButtonBase.WndProc(Message & m)
at System.Windows.Forms.Button.WndProc(Message & m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message & m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG & msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at SaveAsPDFError.Program.Main() in D:\Users\shinks\Documents\Visual Studio 2008\Projects\SaveAsPDFError\SaveAsPDFError\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: