PDA

View Full Version : Divide by zero error when saving to PDF


Unregistered
November 11, 2002, 21:36:46
I am developing a Windows service in C#.Net that needs to save a RTF document to PDF. When executing the Save() method, a DivideByZeroException occurs:

System.DivideByZeroException: Attempted to divide by zero.
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

An empty .PDF file is actually created in the specified directory. The file cannot be opened successfully, however.

axRTFControl.Save(PDF_FILE, (object)null, 12, (object)false);

The above call is successful when called from a standard .EXE. It only fails when called from the Windows service. Is Save not possible from a Windows service?


This message was originally posted by Richard Stallings in the old TX Text Control Support Forum.