468,103 Members | 1,387 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

How to print from the server?

I want users to be able to select a picture on an ASP.NET
webform and have the picture print from one of the
server's printers that is installed in windows. I used
code that worked in a windows standalone app and it gave
no error, but did not print either. How should I go about
setting this up?
Here is my code I have tried:
private void buttonPrint_Click(object sender,
System.EventArgs e) {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
private void pd_PrintPage(object sender,
PrintPageEventArgs e) {
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush
(Color.Black);
PointF drawPoint = new PointF(150.0F, 150.0F);
e.Graphics.DrawString("Hello World", drawFont,
drawBrush, drawPoint);
}

Nov 18 '05 #1
3 1298
The printers are installed per user. So different user can have different
printer settings.
IIS is running under different account (user) so it doe not have a default
printer set.

You will need to look up an KB article on how to set up a printer for IIS
service.
George.

"Kyle" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I want users to be able to select a picture on an ASP.NET
webform and have the picture print from one of the
server's printers that is installed in windows. I used
code that worked in a windows standalone app and it gave
no error, but did not print either. How should I go about
setting this up?
Here is my code I have tried:
private void buttonPrint_Click(object sender,
System.EventArgs e) {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
private void pd_PrintPage(object sender,
PrintPageEventArgs e) {
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush
(Color.Black);
PointF drawPoint = new PointF(150.0F, 150.0F);
e.Graphics.DrawString("Hello World", drawFont,
drawBrush, drawPoint);
}

Nov 18 '05 #2
Are we to assume that the users are at least in the same building as the web
server here? They would have to be in order to fetch the pictures that the
server prints out.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Kyle" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
I want users to be able to select a picture on an ASP.NET
webform and have the picture print from one of the
server's printers that is installed in windows. I used
code that worked in a windows standalone app and it gave
no error, but did not print either. How should I go about
setting this up?
Here is my code I have tried:
private void buttonPrint_Click(object sender,
System.EventArgs e) {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
private void pd_PrintPage(object sender,
PrintPageEventArgs e) {
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush
(Color.Black);
PointF drawPoint = new PointF(150.0F, 150.0F);
e.Graphics.DrawString("Hello World", drawFont,
drawBrush, drawPoint);
}

Nov 18 '05 #3
Yes, the targeted user will be right next to the printer.
All the other users will be submitting the jobs not
caring to pick up the print jobs.
-----Original Message-----
Are we to assume that the users are at least in the same building as the webserver here? They would have to be in order to fetch the pictures that theserver prints out.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Kyle" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl...
I want users to be able to select a picture on an ASP.NET webform and have the picture print from one of the
server's printers that is installed in windows. I used
code that worked in a windows standalone app and it gave no error, but did not print either. How should I go about setting this up?
Here is my code I have tried:
private void buttonPrint_Click(object sender,
System.EventArgs e) {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
private void pd_PrintPage(object sender,
PrintPageEventArgs e) {
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush
(Color.Black);
PointF drawPoint = new PointF(150.0F, 150.0F);
e.Graphics.DrawString("Hello World", drawFont,
drawBrush, drawPoint);
}

.

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.