PrintDialogFit throw excption

Discussions about document printing in GdPicture.NET using GdPictureImaging.
Post Reply
kenfly51
Posts: 1
Joined: Wed Jun 20, 2012 1:22 pm

PrintDialogFit throw excption

Post by kenfly51 » Wed Jun 20, 2012 1:28 pm

currently i'm working with printing function and i used function PrintDialogFit(IWin32Window) for printing, but it's unstable, some pc can print well, but some, and it throw exception:

Code: Select all

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Drawing.Printing.PrinterSettings.GetModeField(ModeField field, Int16 defaultValue, IntPtr modeHandle)
   at System.Drawing.Printing.PrinterSettings.get_Collate()
   at System.Windows.Forms.PrintDialog.GetFlags()
   at System.Windows.Forms.PrintDialog.ShowPrintDialog(IntPtr hwndOwner, PRINTDLGEX data)
   at System.Windows.Forms.PrintDialog.RunDialog(IntPtr hwndOwner)
   at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   at gdpicture_?.gdpicture_?(IWin32Window A_0, Boolean A_1, Single A_2, Single A_3, Single A_4, Single A_5, Boolean A_6)
   at GdPicture.GdViewer.PrintDialogFit(IWin32Window owner)
   at EDM.UI.ViewModels.DocumentViewerViewModel.PrintAttachment()
i can not figure out what happened, please help me, thanks

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: PrintDialogFit throw excption

Post by Loïc » Tue Jun 26, 2012 12:51 pm

Hello,

I think you have a problem with the printer driver. Basically the WinAPI fails to shows the generic printing dialog box.

What I can suggest you is to catch & handle the raised exception by wrapping your call between try/catch/finally block.

The next release will return a proper GdPictureStatus instead of raising such exception.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest