Reputation: 27
I made a code that generate a QRcode. And now I'm trying to print it in thermal paper . But how can i print it specific size of paper? Thank you
Private Sub GraphicPrint(ByVal sender As Object, ByVal e As PrintPageEventArgs)
Dim x As Integer = 60
Dim y As Integer = 60
Dim width As Integer = 100
Dim height As Integer = 50
' e.Graphics.DrawImage(Image.FromFile(GraphicLocation.Text), x, y, width, height, e.Graphics.VisibleClipBounds)
e.Graphics.DrawImage(Image.FromFile(GraphicLocation.Text), x, y, width, height)
e.HasMorePages = False
End Sub
Private Sub BeginGraphicPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeginGraphicPrint.Click
Try
AddHandler PrintGraphicControl.PrintPage, AddressOf Me.GraphicPrint
PrintGraphicControl.Print()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Upvotes: 0
Views: 1030
Reputation: 11
try something like this
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim g As Graphics = e.Graphics
' Draw image to screen.
g.DrawImage(Piccode.Image, 0, 0, 100, 100)
End Sub
Upvotes: 1