1

Resolved

Printing Exception

description

James,
 
There also seems to be an issue with printing.
 
The following simple code causes a Parameter Is not valid exception in PrintDocument.cs --> PrintPageHandlerRender at e.Graphics.Clip = new Region().
 
Open.Diagramming.Printing.PrintDocument MyDocument = new Open.Diagramming.Printing.PrintDocument(DiagramControl);
MyDocument.Diagram = DiagramControl;
MyDocument.PrintPreview();
 
Cheers mate.

comments

john_crocker wrote Jul 10, 2009 at 10:27 AM

Hi James

I get that too.. Full Exception details attached below:

System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.SetClip
at System.Drawing.Graphics.set_Clip
at Open.Diagramming.Printing.PrintDocument.PrintPageHandlerRender in C:\DNLD\Components\Diagram 5.0\Open.Diagramming.Forms\Open.Diagramming.Printing\PrintDocument.cs:line 305
at System.Drawing.Printing.PrintDocument.OnPrintPage
at System.Drawing.Printing.PrintDocument._OnPrintPage
at System.Drawing.Printing.PrintController.PrintLoop
at System.Drawing.Printing.PrintController.Print
at System.Drawing.Printing.PrintDocument.Print
at MarblesGui.Forms.FormUml.PrinttoolStripButtonClick in c:\DEV\Marbles.Net\MarblesGui\Forms\FormUml.cs:line 127
at System.Windows.Forms.ToolStripItem.RaiseEvent
at System.Windows.Forms.ToolStripButton.OnClick
at System.Windows.Forms.ToolStripItem.HandleClick
at System.Windows.Forms.ToolStripItem.HandleMouseUp
at System.Windows.Forms.ToolStripItem.FireEventInteractive
at System.Windows.Forms.ToolStripItem.FireEvent
at System.Windows.Forms.ToolStrip.OnMouseUp
at System.Windows.Forms.Control.WmMouseUp
at System.Windows.Forms.Control.WndProc
at System.Windows.Forms.ScrollableControl.WndProc
at System.Windows.Forms.ToolStrip.WndProc
at ControlNativeWindow.OnMessage
at ControlNativeWindow.WndProc
at System.Windows.Forms.NativeWindow.DebuggableCallback
at ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
at ThreadContext.RunMessageLoopInner
at ThreadContext.RunMessageLoop
at System.Windows.Forms.Application.Run
at MarblesGui.Program.Main in c:\DEV\Marbles.Net\MarblesGui\Program.cs:line 31

JamesWestgate wrote May 1, 2010 at 2:54 PM

This issue has now been fixed. PrintDocument calls RenderLayer directly, bypassing the graphics object setup. Previously, graphics object was being disposed, causing the invalid parameter error.

wrote May 1, 2010 at 2:54 PM

wrote Feb 14, 2013 at 7:33 PM

wrote May 16, 2013 at 9:39 AM

wrote May 16, 2013 at 9:39 AM

wrote Jun 14, 2013 at 7:13 AM