Rahul Sharma

Rahul Sharma

  • NA
  • 20
  • 9.1k

The RPC server is unavailable when printing on network print

May 13 2014 1:18 AM
hi 
I am trying to print a report (.rdlc) from button click as below. It throws a message "The RPC server is unavailable.".
 
private void btnPrint_Click(object sender, EventArgs e)
{

 Report1.PrintOptions.PrinterName = cmbPrinters.Text;
 Report1.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)GetPaperSize(cmbPrinters.Text, "A4");
 //PaperSize.PaperA4
 Report1.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
 Report1.PrintToPrinter(1, false, 1, 1);

}
when it comes to the line : Report1.PrintToPrinter(1, false, 1, 1);
it throws exception saying "The RPC server is unavailable". The printer is working fine. Its a network printer and I have given proper path for it.
The point to be noted is, when for the first time I tried to print it threw exception saying "The RPC server is unavailable" there after.
I got same message when i click on print button which is inside ReportViewer Control. How can i resolve it.
Please help.
 
Thanks

Answers (4)