Hi,
I am trying to send multiple copies to the printer, can anybody help?
Here is my code
Private Sub Printdocument1_Printpage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim Numchars As Integer
Dim Numlines As Integer
Dim StringforPage As String
Dim StringFormat As New StringFormat()
Dim Printfont As Font
Printfont = Promo_Print_TextBox.Font
Dim rectDraw As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height)
Dim Sixemeasure As New SizeF(e.MarginBounds.Width, e.MarginBounds.Height - Printfont.GetHeight(e.Graphics))
StringFormat.Trimming = StringTrimming.Word
e.Graphics.MeasureString(StringToPrint, Printfont, Sixemeasure, StringFormat, Numchars, Numlines)
StringforPage = StringToPrint.Substring(0, Numchars)
e.Graphics.DrawString(StringforPage, Printfont, Brushes.Black, rectDraw, StringFormat)
If Numchars < StringToPrint.Length Then
StringToPrint = StringToPrint.Substring(Numchars)
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub
Any help would be very much appreciated. Thanks
I am trying to send multiple copies to the printer, can anybody help?
Here is my code
Private Sub Printdocument1_Printpage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim Numchars As Integer
Dim Numlines As Integer
Dim StringforPage As String
Dim StringFormat As New StringFormat()
Dim Printfont As Font
Printfont = Promo_Print_TextBox.Font
Dim rectDraw As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height)
Dim Sixemeasure As New SizeF(e.MarginBounds.Width, e.MarginBounds.Height - Printfont.GetHeight(e.Graphics))
StringFormat.Trimming = StringTrimming.Word
e.Graphics.MeasureString(StringToPrint, Printfont, Sixemeasure, StringFormat, Numchars, Numlines)
StringforPage = StringToPrint.Substring(0, Numchars)
e.Graphics.DrawString(StringforPage, Printfont, Brushes.Black, rectDraw, StringFormat)
If Numchars < StringToPrint.Length Then
StringToPrint = StringToPrint.Substring(Numchars)
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub
Any help would be very much appreciated. Thanks