Printing from code behind????

  • Thread starter Thread starter Federico Benitez
  • Start date Start date
F

Federico Benitez

I am trying to print from code behind and get the
following error:

"The RPC server is unavailable"

I am using the following code:

StreamReader streamToPrint = new StreamReader
("frmPatientSearch.txt");

try
{
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(pd_PrintPage);
// Print the document.
pd.Print();
}
catch(Exception ex)
{
throw ex;
}
finally
{
streamToPrint.Close() ;
}
}
 
Back
Top