Connecting Tech Pros Worldwide Forums | Help | Site Map

Printing from code behind????

Federico Benitez
Guest
 
Posts: n/a
#1: Nov 18 '05
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() ;
}
}
Chris Jackson
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Printing from code behind????


There is a KB article on this - the problem has to do with permissions:

http://support.microsoft.com/default...b;en-us;312055

Do you intend to have the server print instead of the client?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Federico Benitez" <federicob@infocorp.com.uy> wrote in message
news:0b1101c3b4e6$b19a40e0$a301280a@phx.gbl...[color=blue]
> 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() ;
> }
> }[/color]


Closed Thread