Home > The Handle > Print And The Handle Is Invalid

Print And The Handle Is Invalid


PrintDocument doc = new PrintDocument(); doc.PrinterSettings.PrinterName = @"\\\hp LaserJet 1010 Series Driver"; doc.PrintPage += Doc_PrintPage; doc.Print(); ============================================================================ private void Doc_PrintPage(object sender, PrintPageEventArgs e) { e.Graphics.DrawImage(Image.FromFile(@"C:\Temp\test.jpg"), e.MarginBounds.Left, e.MarginBounds.Top); } Was Obi-Wan the first Jedi (or first person) to transform bodily into a Force Ghost? To check whether it is related to ActiveReports or not, can you create a separate app, implement system.printing.drawing and run it as a service, just as you have it with ActiveReports All Rights Reserved. Check This Out

Here is the error: Printing Thread error: The handle is invalid. Privacy Statement| Terms of Use| Contact Us| Advertise With Us| CMS by Umbraco| Hosted on Microsoft Azure Feedback on ASP.NET| File Bugs| Support Lifecycle Sign In Shopping Cart LIMITED TIME OFFER: Please let me know if I missed anything important.BTW, unfortunately, I don't quite understand the issue with the devxtest.exe.config and debxservice.exe.config files. Dim objPageSettings As PageSettings = New PageSettings Dim objPrinterSettings As PrinterSettings = New PrinterSettings() Dim objPrintDocument As PrintDocument = New PrintDocument() dim bytRenderedReport as Byte()() = Nothing bytRenderedReport = RenderReport(reportPath) 'Path https://social.msdn.microsoft.com/Forums/windows/en-US/eea1c3d2-7de5-48cd-ba3c-0af16bb3995e/systemdrawingprinting-win32exception-the-handle-is-invalid?forum=winforms

Print And The Handle Is Invalid

If I have an instance of an ActiveReport3 object and a valid PrinterSettings object, what do I need to do next? I tried the same function under windows XP and it worked just fine.. Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. Why is my scene rendered repeatedly when I press F12?

Maybe in a .NET Windows app the "Target CPU" setting could also cause a similar issue? I will check on this.Since this works as a service on W7, but not on Server 2008 or XP as a service, there must be something about 2008 that is causing We deploy to Windows Server 2008 R2. A Transport-level Error Has Occurred When Receiving Results From The Server Thanks,Lee # Anonymous 7 years, 3 months ago (EDIT: this test was done with 5.2.1331.2) In your sample project, I added Document.Printer.PrinterName = string.Empty; to the Report's constructor.

Since the same set of assemblies is running in both situations, that rules out a missing assembly since the print would fail in both cases. width = 1024 height = 768 m_delegate = New EnumerateMetafileProc(AddressOf MetafileCallback) g.EnumerateMetafile(m_metafile, destRect, m_delegate) m_delegate = Nothing End SyncLock End Sub Private Function MetafileCallback(ByVal recordType As EmfPlusRecordType, ByVal flags As Integer, BTW, I think that we'll be able to diagnose this problem more clearly if enable the "Allow Interact with Desktop" option of the service. Here are some of the other exceptions we are seeing:A null context handle was passed from the client to the host during a remoteprocedure callA StartDocPrinter call was not issuedNo printers

DevXServiceTest.zip 0 Kenneth Russo 07.28.2010 The problem with the config files is I can't type. Here is a corresponding issue link: PRB: Errors When Printing from ASP Pages or from Windows Services (see also: C# service printing). Monday, April 09, 2007 9:08 PM Reply | Quote Moderator 0 Sign in to vote Thanks for the response!   Already assigning StandardPrintController to avoid the dialog window. Imported from SC 1.0 ID: B149542 Created On: 07.23.2010 Modified On: 08.04.2010 Build: v2010 vol 1.4 / 19-May-2010 Operating System: Windows 7 x64 IDE: Microsoft Visual Studio 2010 Related Questions Show

Win32exception The Handle Is Invalid C#

share|improve this answer answered Jun 13 '13 at 17:16 Scott Willeke 5,64211933 None of the above works. Meanwhile, it would perhaps be helpful if you could tell me the proper steps to take to print from this class, without using the Windows default printer. Print And The Handle Is Invalid Thanks,   Joe Monday, April 09, 2007 8:12 PM Reply | Quote Answers 0 Sign in to vote Found this post from August 20, 2006 which mentions what I thought could Win32exception (0x80004005): The Handle Is Invalid Best regards.

We have a class, NewTechActiveReport that inherits ActiveReport3. his comment is here I’ve also reviewed the Aspose.Words Product Documentation, ‘How-to: Print a Document on a Server via the XpsPrint API’, ( http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-print-a-document-on-a-server-via-the-xpsprint-api.html ) and tried implementing the XpsPrintHelper class to attempt to resolve It looks like only native API should be used for this purpose. Can you please confirm? # Amit Pal 7 years, 3 months ago Hello, We apologize for the confusion here. Provider Tcp Provider Error 0 The Handle Is Invalid

Learn more about SAP Q&A. Word that means "to fill the air with a bad smell"? View All Notifications Email : * Password : * Remember me Forgot password? this contact form If anyone has seen this before and/or knows why it maybe happening, it would be great to hear from you.

using (ReportDocument ZeroUpfrontContract = new AL.rptZeroUpfrontContract()) { ZeroUpfrontContract.SetParameterValue("Header1", BL.HeaderRecord.m_HeaderLine1); ZeroUpfrontContract.SetParameterValue("Header2", BL.HeaderRecord.m_HeaderLine2); ZeroUpfrontContract.SetParameterValue("Header3", BL.HeaderRecord.m_HeaderLine3); ZeroUpfrontContract.SetParameterValue("Header4", BL.HeaderRecord.m_HeaderLine4); ZeroUpfrontContract.SetParameterValue("Header5", BL.HeaderRecord.m_HeaderLine5); ZeroUpfrontContract.SetParameterValue("Stock_code", txtBarCode.Text.Length > 0 ? this happens only if the server is windows 2003. Any help would be appreciated!

If they are, it generates the report and feeds it into the ReportPrintTool.

The coding is the same project in both the app and the service, so there is no difference on the coding.Thanks. 0 Andrew L (DevExpress Support) 07.23.2010 Hi Kenneth,Unfortunately it's hard C# Corner Contribute An Article A Blog A News A Video A Link An Interview Question Ask a Question TECHNOLOGIES .NET Chapters How do I Office Development SQL Server .NET more hot questions question feed about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Science All contents are copyright of their authors.

Since it works as a console app, I am asking the server people what could be different on access to the printer in the service. The application is a report scheduler which looks at a queue in a database table every few seconds and checks to see if any reports are scheduled to run. Error source: System.DrawingError: The RPC server is unavailable Begin stack trace...Stack: atSystem.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocumentdocument, PrintEventArgs e) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at C1.C1PrintDocument.PrintHelper.Print() at C1.C1PrintDocument.C1PrintDocument.Print(PrinterSettingsprinterSettings, Boolean showProgressDialog) at C1.C1PrintDocument.C1PrintDocument.Print(Boolean showProgressDialog) at user code... navigate here Brandenburg Concerto No. 5 in D: Why do some recordings seem to be in C sharp?

I found many, many forum posts that suggest setting Document.Printer.PrinterName to "", which fixed that problem, but introduced another problem. The second situation uses the same ActiveReport3 derived class to attempt to print a completely different report. # Anonymous 7 years, 3 months ago Anyone? Could you please provide me the sample which shows this issue so that I can test it at my end and may try to fix the cause?