printing with a network printer on a server side

printing with a network printer on a server side

Forum member · Jun 23, 2010
Hi, When I'm trying to print from my web application I got this error: External component has thrown an exception. This error happen on the command : Dim MyPrintJob As PrintJob = New PrintJob("\\xeon\TOSHIBA e-STUDIO350-450 PCL6 (Copie 1)", MyInputPdf) But when I used the same code locally, it works fine... It's only on a server side. Thanks.

Re: printing with a network printer on a server side

Support · Jun 23, 2010
Hello, Can you please provide us with the entire stack trace of the error message that you are seeing? Also please make sure that you are using the latest build DLL files from the website. Also please make sure that you have permissions set on the server to access the network printer. Try printing other document manually from the server to the printer and see if prints fine. Thanks, ceTe Software Support Team

Re: printing with a network printer on a server side

Forum member · Jul 5, 2010
Hi, The error message is "External component has thrown an exception." I used the lastest build DLL and I'm able to print a file from the server to the printer. To do more test, I made a windows application that make the sameting that my web application and I runed it locally on the server and It works fine. Here is my code: Try Dim MyPrintJob As PrintJob = New PrintJob("\\xeon\TOSHIBA e-STUDIO350-450 PCL6 (Copie 1)", MyInputPdf) AddHandler MyPrintJob.Failed, AddressOf Printer_PrintJobFailed MyPrintJob.Print() Catch ex As Exception Response.Write(ex.Message) Response.Write(ex.InnerException) End Try This code is exacly the same in both application (web and winapp). I am sure that the error happen when I do "New PrintJob..." because I put "MyPrintJob.Print" in comments to test which line cause the error. Thanks.

Re: printing with a network printer on a server side

Support · Jul 6, 2010
Hello, Does the printer that you are trying to print to showing up under Printer and Faxes on your machine? Set "TOSHIBA e-STUDIO350-450 PCL6 (Copie 1)" as your default printer and then try using Printer.Default and see if it prints to this printer. Thanks, ceTe Software Support Team

Re: printing with a network printer on a server side

Forum member · Jul 6, 2010
Yes I see it under Printer and Faxes. I puted it to default printer and used Printer.Default and it does not work.

Re: printing with a network printer on a server side

Support · Jul 6, 2010
Hello, Try using the static GetLocalPrinters() method of the Printer object that returns an array of the local printers on your machine. This will return the exact machine name to use for printing. There is likely a space before or after the printer name that is causing this behavior. If you output the printer name to console you will see the exact printer names. Following is the sample code: var printers = Printer.GetLocalPrinters(); foreach (var pr in printers) Response.Write(String.Format("|{0}|<br />", pr.Name)); Thanks, ceTe Software Support Team

Re: printing with a network printer on a server side

Forum member · Jul 7, 2010
I already try this function and it does not return the printer that I tried to use. But if I runed the winapp locally, the function returned the printer name that I want to used... The problem happens only on server... Thanks. Emilie

Re: printing with a network printer on a server side

Support · Jul 7, 2010
Hello Emilie, Can you please send the screenshot of "Printer and Faxes" on the server to our [^a|mailto:support@cete.com|opennewiwndow|Support Team^] so that they can look into this further? Also please verify the printer name that is getting returned by the winapp when run locally. Make sure that you are using the exact same name from the server. Also are you able to open a PDF file and print manually to that printer? Thanks, ceTe Software Support Team

Re: printing with a network printer on a server side

Forum member · Jul 12, 2010
Hello, At which email address can I send you the print screen? I used the exact same name that the winapp returned locally and yes I'm able to open and print a pdf file manually. Thanks, Emilie