Hi,
I'm trying to print barcodes to the Dymo LabelWriter printer. Put everytime
I send a job to the label printer it just outputs an empty label. If I change
the default printer back to the standard printer(HP LaserJet), it prints
fine. Has anyone worked with Label printers like this. Here is the code I'm
using:
Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdPrint.Click
try
Dim BarCode as New clsBarCode
Dim TextToPrint as String
VariableToPrint = BarCode.Code39( txtPatientID.Te xt )
barcode.PrintBa rCode("Free 3 of 9 Extended", VariableToPrint , 12)
exit sub
Dim PrintDoc As New PrintDocument()
PrintFont = New Font("Free 3 of 9 Extended", 12) 'IDAutomationHC 39M", 12)
AddHandler PrintDoc.PrintP age, AddressOf Me.PrintDoPrint Page
PrintDoc.Print( )
Catch ex As Exception
End Try
End Sub
Private sub PrintDoPrintPag e(sender as Object, ev as
System.Drawing. Printing.PrintP ageEventArgs)
try
Dim linesPerPage As Single = 0 'Number of lines (bar codes) that you will be
able to fit on the page
Dim yPos As Single = 0 'yPos on the page of the bar code
Dim leftMargin As Single = ev.MarginBounds .Left 'left margin of bar code
Dim topMargin As Single = ev.MarginBounds .Top 'top margin of bar code
Dim line As String = Nothing 'String that font will be applied to and
printed
linesPerPage = ev.MarginBounds .Height / PrintFont.GetHe ight(ev.Graphic s)
yPos = 10
line = VariableToPrint
ev.Graphics.Dra wString(line, PrintFont, Brushes.Black, leftMargin, yPos, New
StringFormat())
Catch ex As Exception
End Try
End Sub
Thank you for any help that you may have.
Michael
I'm trying to print barcodes to the Dymo LabelWriter printer. Put everytime
I send a job to the label printer it just outputs an empty label. If I change
the default printer back to the standard printer(HP LaserJet), it prints
fine. Has anyone worked with Label printers like this. Here is the code I'm
using:
Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles cmdPrint.Click
try
Dim BarCode as New clsBarCode
Dim TextToPrint as String
VariableToPrint = BarCode.Code39( txtPatientID.Te xt )
barcode.PrintBa rCode("Free 3 of 9 Extended", VariableToPrint , 12)
exit sub
Dim PrintDoc As New PrintDocument()
PrintFont = New Font("Free 3 of 9 Extended", 12) 'IDAutomationHC 39M", 12)
AddHandler PrintDoc.PrintP age, AddressOf Me.PrintDoPrint Page
PrintDoc.Print( )
Catch ex As Exception
End Try
End Sub
Private sub PrintDoPrintPag e(sender as Object, ev as
System.Drawing. Printing.PrintP ageEventArgs)
try
Dim linesPerPage As Single = 0 'Number of lines (bar codes) that you will be
able to fit on the page
Dim yPos As Single = 0 'yPos on the page of the bar code
Dim leftMargin As Single = ev.MarginBounds .Left 'left margin of bar code
Dim topMargin As Single = ev.MarginBounds .Top 'top margin of bar code
Dim line As String = Nothing 'String that font will be applied to and
printed
linesPerPage = ev.MarginBounds .Height / PrintFont.GetHe ight(ev.Graphic s)
yPos = 10
line = VariableToPrint
ev.Graphics.Dra wString(line, PrintFont, Brushes.Black, leftMargin, yPos, New
StringFormat())
Catch ex As Exception
End Try
End Sub
Thank you for any help that you may have.
Michael
Comment