- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Vb.Net Problem - Printing Multiple Pages
Can anybody help?
I have create a string of text, in a variable called "TempString". I know, if I was to print this string of text using Notepad, it would print out several pages.
However, I am using the following Vb.Net code, shown below, to print the string of text the default printer.
The problem is that it only ever prints out one page only, not several as expected.
Does anybody know is wrong with the following code?
Public Sub PrintTextFile()
Dim prn As New Printing.PrintDocument
Using (prn)
prn.PrinterSettings.PrinterName = "\\USFS-02\HPM479_5"
AddHandler prn.PrintPage, AddressOf Me.PrintPageHandler
prn.Print()
RemoveHandler prn.PrintPage, AddressOf Me.PrintPageHandler
End Using
End Sub
Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
Dim myFont As New Font("Lucida Console", ![]()
args.Graphics.DrawString(TempString, New Font(myFont, FontStyle.Regular), Brushes.Black, 50, 50)
End Sub
Many thanks in advance!
Darren