473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 1481
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tessa | last post by:
Is there any security reason why you cannot print to a network printer from ASP.NET under IIS6 on Windows 2003 server? I'm using ASP.NET code to print to a server print queue using...
2
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the...
4
Rabbit
by: Rabbit | last post by:
Here's my question. Does my connecting to the printer by IP affect the print server? The circumstances surrounding this question follows below. We have 16 network printers, most of them HP...
10
by: S_K | last post by:
Hi, I have a directory full of a number of .PDF files that I need to print. Is there any simple way to do this? Using PdfReader purhaps? Thanks in advance. Steve
3
by: joshbay84 | last post by:
window.close() is not working after print preview and close preview window using the window
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.