locked
Delay when using reportDocument.PrintOptions.PrinterName = @"\\PrinterMachine\PrinterName"; RRS feed

  • Question

  • User528608107 posted

    Hello guys,

    a delay for 20-30 seconds happens when I try to use the following code that directly prints a crystal report file without a print dialog.

     

    ReportDocument rd = new ReportDocument();
                rd.Load(MapPath("rpt1.rpt"));
                rd.PrintOptions.PrinterName = @"\\PrinterMachine\PrinterName";
                rd.PrintToPrinter(1, false, 1, 1);

    During debugging it was obvious that the delay happens in the third line rd.PrintOptions.PrinterName = @"\\MachineName\PrinterName";  , it seems that the server takes time to look for the shared printer which is already added to it. the printer connected localy and shared on another machine lets call it PrinterMachine which has windows XP prof SP2 32 bits on it, the web application is hosted on Server1 which has windows server 2008 R2 64 bits 8 GB of RAM and 4 Processors  3 GHz.

    I tried to host the web application on another similar server "Server2"and added the printer to it, and the same delay happened before printing, I also hosted it on another similar machine "Server3" but with 32 Bits windows server 2008 instead of 64Bits and the same delay happened again on the same line.

    Now the weird thing is, I hosted the application on my machine "another different machine not the PrinterMachine" which has windows XP SP2 32 Bits and 3 GB RAM Inter Core Quad 2.8 Ghz and added the shared printer to it , and it was working like a charm , printing doesn't take more than 2 seconds !

    What on earth might be the problem ! do you think its the OS that casues the delay ?

     please help

    Sunday, July 10, 2011 2:49 AM

Answers