Print Multiple Pages

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
HI



In a previous topic
The barcode is designed by DataGridViewcells
I want a way if the print page finishes going to a new page
No matter how many pages or elements are added.

print item


Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim x As Integer = 20
Dim y As Integer = 20
For Each bc As Image In barcodes
e.Graphics.DrawImage(bc, New Point(x, y))
y += 60
Next
End Sub

my edit code to Print Multiple Pages

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
On Error Resume Next
Dim i As Integer = 1
Dim x As Integer = 20
Dim y As Integer = 20
For Each bc As Image In barcodes
If y < (e.MarginBounds.Bottom - 40) Then
e.Graphics.DrawImage(bc, New Point(x, y))
Else
e.Graphics.DrawImage(bc, New Point(x, y))
e.HasMorePages = True
Exit Sub
End If
y += 60
i += 1
If Not e.HasMorePages Then i += 0
Next
End Sub

Continue reading...
 
Back
Top