This is a migrated thread and some comments may be shown as answers.

'The handle is invalid' Error

11 Answers 988 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Geoff Suddard
Top achievements
Rank 1
Geoff Suddard asked on 29 Jan 2008, 09:10 PM
Hi, do you have any information on the 'The handle is invalid' error being generated by a Telerik.Reporting.Processing.ReportProcessor.Print call.  I use default settings in the PrintDocument Object.  The call only fails on a Windows 2003 machine, working flawlessly on a Windows XP machine.  I'm not sure what other info I can provide.

Geoff

11 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 30 Jan 2008, 10:10 AM
Hello Geoff,

From the information you supply it is not clear what is the reason for the exception. Please send us the full stack trace. Additionally it will be helpful if you send us the problematic report along with your source code that makes the Print call.

Meanwhile, we can suggest that you check the printer settings on your Windows 2003 machine.

We hope that the problem will be quickly resolved with your cooperation.

Greetings,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Geoff Suddard
Top achievements
Rank 1
answered on 30 Jan 2008, 03:39 PM
Below please find the stack trace:

System.ComponentModel.Win32Exception: The handle is invalid
   at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
   at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
   at System.Drawing.Printing.PrintController.Print(PrintDocument document)
   at System.Drawing.Printing.PrintDocument.Print()
   at Telerik.Reporting.Processing.ReportProcessor.Print(Report report, PrinterSettings printerSettings)
   at PrinterQueue.frmMain.ProcessQueue()

The code which calls the method follows:

Dim ps As PrinterSettings = pd.PrinterSettings
Dim rpt As New rptPurchasingReceiving

Telerik.Reporting.Processing.ReportProcessor.Print(rpt, ps)

I can't seem to add a file attachment to the post, so please instruct how to get the report file to you.  Thanks.

Geoff
0
Chavdar
Telerik team
answered on 30 Jan 2008, 04:32 PM
Hi Geoff Suddard,

The stack trace shows that the exception is thrown by a generic .net object which is out of our reach. This indicates a system error and might be caused by various reasons: invalid printer, security restrictions, etc.

In order to better troubleshoot the issue you can try several things. For example:

    1. Setup a different default printer, try again and check whether this problem happens regardless the selected printer.

    2. You can try to print the report without passing a PrinterSettings object so that the default Print dialog appears.

    3. Use a brand new PrinterSettings object, for example:

    Telerik.Reporting.Processing.ReportProcessor.Print(rpt, new PrinterSettings())

We hope that these suggestions might help. We are also interested in whether this happens every time or accidentally.

All the best,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Geoff Suddard
Top achievements
Rank 1
answered on 30 Jan 2008, 06:45 PM
Thank you for your help. I will try your suggestions.

Geoff
0
Geoff Suddard
Top achievements
Rank 1
answered on 30 Jan 2008, 07:23 PM
None of these suggestions worked, I'm afraid... however, I was able to print, with no problem, from the ReportViewer object.

Geoff
0
Svetoslav
Telerik team
answered on 31 Jan 2008, 02:09 PM
Hi Geoff,

Since the winforms ReportViewer use the same method to print the current report the explained behavior is very strange. Please open a separate support ticket and send us a project that can demonstrate the described problem so we can examine it and give back with a proper solution.

Thank you in advance.

Kind regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Issa
Top achievements
Rank 1
answered on 09 Sep 2008, 01:14 PM
Svetoslav ,

were you able to solve this problem, I'm kinda having the same problem where calling the print function will cause the website to hang. this happens only if the server is windows 2003. I tried the same function under windows XP and it worked just fine..

any updates on this issue.
thanks.

Hisham Abbas,
0
Steve
Telerik team
answered on 09 Sep 2008, 01:42 PM
Hello Hisham,

Unfortunately Geoff has not sent his report and we were not able to reproduce the problem on Win 2003 locally. You're the second person after Geoff reporting this issue, so we believe that the issue is not in our Reporting offering. It must be some kind of security restriction on that specific machine - do you get the same if you browse the report through another machine and try the same (if not, this would mean the browser is causing the problem)? Can you try this on a vanilla installation of Win2003 without any additional configurations? As a last resort, you can send us a sample runnable report that we can use to replicate the issue locally and we would get back to you with more info.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Issa
Top achievements
Rank 1
answered on 09 Sep 2008, 02:42 PM
Steve,
Thanks for the fast reply,

the thing I'm trying to do is to print a Telerik report on the client side (meaning client printer) programmatically without having report viewer in the page.

So when the user click on some button, I will generate the report in the background and promote the user to select a local printer, print the report or maybe not and then do some action on the server.

Is there any example you can help me with. Again thanks for the fast reply.

Best,
Hisham.
0
Steve
Telerik team
answered on 09 Sep 2008, 02:53 PM
Hello Hisham,

You are not able to print the report on the client with code that is on the server. You would need to use our Web ReportViewer clientAPI in order to achieve the desired result. More info can be found in this forum thread.

All the best,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Issa
Top achievements
Rank 1
answered on 09 Sep 2008, 03:42 PM
Steve,

Thanks a lot, problem solved.
Tags
General Discussions
Asked by
Geoff Suddard
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Geoff Suddard
Top achievements
Rank 1
Chavdar
Telerik team
Svetoslav
Telerik team
Issa
Top achievements
Rank 1
Steve
Telerik team
Share this question
or