Posted 14 September 2017, 9:29 am EST
[activereports_archive]Development Environment:
- Windows 8 Professional
- Visual Studio 2012 Professional (Using VB, .NET Framework 4)
- ActiveReports 7.1.7572.0
My customer runs the compiled application on Windows Server 2012.
When using the Print button from the Viewer, after showing the Printer Properties window, this error might appear:
System.ApplicationException: The current printer caused a Windows error:
—> System.ArgumentException: Handle 0 is not valid.
by System.Drawing.Printing.PrinterSettings.SetHdevmode(IntPtr hdevmode)
by GrapeCity.ActiveReports.Viewer.Win.Controls.CustomPrintDialog.#tTB(#tqC pdlg)
by GrapeCity.ActiveReports.Viewer.Win.Controls.CustomPrintDialog.RunDialog(IntPtr hwndOwner)
by System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
by GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.#zs(#q0B documentPrintAdapter, Action
1 action) <br /> by GrapeCity.ActiveReports.Viewer.Win.Printing.PrintImpl.Print(#q0B documentPrintAdapter, Boolean showPrintDialog, Boolean showPrintProgressDialog, Boolean usePrintingThread, Action
1 action)by GrapeCity.Viewer.Common.ViewModel.ToolbarViewModel.<>c__DisplayClass39.#5kz()
by System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
by System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
by System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
by System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
by System.Windows.Forms.Control.WndProc(Message& m)
by System.Windows.Forms.ToolStrip.WndProc(Message& m)
by System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Very thorough testing learned:
The error above appears when:
- The end user is not printing to the default printer, or
- The end user is printing to the default printer and has at least 1 property changed (color, duplex, …)
It is not dependant on one specific printer. Various printers are defined and they are all affected.
Problem in brief:
The only way to print without getting this error, is printing to the default printer, without changing any printer properties.
More information:
I have very recently setup my development PC from scratch:
Windows 7 - Windows 8
VS2010 - VS2012
AR6 - AR7
When I read the exception, it seams the exception is thrown when ActiveReports’ CustomPrintDialog is passing its setting to System.Drawing.Printing.PrinterSettings.
I am not able to reproduce this problem on my development PC. It seems related to running the application on Windows Server 2012.
Additional information:
It seems this error also has something to do with upgrading to ActiveReports 7.1.7572.0. When I used ActiveReports 7.1.7470.0, the end users also complained about printing.
With ActiveReports 7.1.7470.0 they did not get an error. But when printing, they have to change printer setting very often: Setting color to yes/no, using simplex or duplex, and selecting a different paper bin.
Whatever printer setting(s) they changed, is was completely ignored by ActiveReports. Since 7.1.7572.0 is used, they get this error instead.
Therefore I think GrapeCity/ComponentOne must have been working on this part of ActiveReports.
Urgent:
I know, everybody wants his problem solved yesterday. In my case, about 15 employees are affected by this problem on a daily basis. My customer is not amused, to put it mildly. Please help…[/activereports_archive]