Question about Printing
Posted on 2004-11-23
Hello fellow experts. Quick printing question for you:
The following stupid simple code prints a box and some text on a printer.
Dim WithEvents PrintDoc As PrintDocument
Public Sub PrintTestDoc(ByVal Printer As String)
PrintDoc = New PrintDocument
.PrinterSettings.PrinterName = Printer
Catch ex As Exception
Private Sub PrintDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDoc.PrintPage
Dim Font As New System.Drawing.Font("Tahoma", 12, Drawing.FontStyle.Regular)
e.Graphics.DrawString("This is a test printing from a web service.", Font, Brushes.Black, e.MarginBounds.X + 10, e.MarginBounds.Y + 10)
e.HasMorePages = False
I noticed when I run this code, a window pops up that says "Printing page 1 of 1" and then disappears after the document is spooled to the print queue.
Doc comes out just fine.
My question is this: Is there any way to supress that window from popping up? My code is popping anything up.
The underlying problem here is that I am trying to get an INTRAnet web service to print to a network printer and am getting errors printing. I am now thinking that the errors could be explained by the fact that the Web Service doesn't have any UI and possibly can't popup this little window, so if I can suppress the window, perhaps it will finally work!