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
Rahul SharmaPosted May 13, 2014, 2:43 AM
Anupam SinghPosted May 13, 2014, 2:16 AM
CristalReportviewer1 r_viewer=new CristalReportviewer1();
CristalReportviewer1.ReportSource = Report1;
r_viewer.PrintReport();
Hope this will help. otherwise try re-intalling Crystal Report.
Rahul SharmaPosted May 13, 2014, 1:51 AM
Anupam SinghPosted May 13, 2014, 1:44 AM
Try to set Report1.PrintOptions.PrinterName=@"\\192.168.2.197\\HP Laserjet Professional M121";
. hardcode this for testing. and check whether it works or not.
Because it required absolute path.