Click here to Skip to main content
15,905,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I am trying to print a report (.rdlc) from button click as below. It throws a message as same as from a report viewer control.

C#
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 - It goes PaperA4 

   Report1.PrintOptions.PaperOrientation = PaperOrientation.Landscape;

   Report1.PrintToPrinter(1, false, 1, 1);

   MessageBox.Show("Print Done");

}


when it comes to the line :
C#
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. Please help.

Thanks

code block corrected
Posted
Updated 12-May-14 1:02am
v7

1 solution

 
Share this answer
 
Comments
Rahul saraswat 13-May-14 1:06am    
I have applied all the things on my system related to IPC, but still unable to resolve. Even facing same problem with Crystal report viewer, when I click print button inside the Crystal Report Viewer, i got the same message "The RPC Server is unavailable".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900