K
Kyle
Can you raise events from ASP.NET code that will be
handled by windows such as a print event? Is there a
security setting that makes this not allowed. I want to
be able to user the PrintPageEventHandler in my code
(because its the only way I know how to print). When I
run the following code I get an exception saying A
StartDocPrinter call was not issued
private void buttonPrint_Click(object sender,
System.EventArgs e) {
try {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
catch(Exception ex) {
Response.Write(ex.Message);
}
}
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);
}
handled by windows such as a print event? Is there a
security setting that makes this not allowed. I want to
be able to user the PrintPageEventHandler in my code
(because its the only way I know how to print). When I
run the following code I get an exception saying A
StartDocPrinter call was not issued
private void buttonPrint_Click(object sender,
System.EventArgs e) {
try {
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
catch(Exception ex) {
Response.Write(ex.Message);
}
}
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);
}