Barcode printer source code
Posted: Sat Nov 28, 2009 7:05 am
Programme your own POS system - Part 4
This is tested in TM-T88. Following example will print will print barcode "ROBOT.LK" with CODE 39. It is easy to change the barcode type to EAN, UPC, etc... by referring the ESC/POS manual.
Please make sure that you post a reply to say thanks if it works okay for you. 
See also:
ESC/POS printer source code at https://robot.lk/viewtopic.php?f=39&t=874
ESC/POS Customer Display source code at https://robot.lk/viewtopic.php?f=39&t=875
Point of Sale printer/drwer and Customer Display source code at https://robot.lk/viewtopic.php?f=39&t=876
This is tested in TM-T88. Following example will print will print barcode "ROBOT.LK" with CODE 39. It is easy to change the barcode type to EAN, UPC, etc... by referring the ESC/POS manual.
Code: Select all
Private Const GS As Byte = &H1D
Private Function getBarcodeStr(bar_height As Byte, bar_width As Byte, bar_font As Byte, bar_pos As Byte, msg As String) As String
printBarcode = Chr$(GS) & "h" & Chr$(bar_height) 'Bardcode Hieght
printBarcode = printBarcode & Chr$(GS) & "w" & Chr$(bar_width) 'Barcide Width
printBarcode = printBarcode & Chr$(GS) & "f" & Chr$(bar_font) 'Font for HRI characters
printBarcode = printBarcode & Chr$(GS) & "H" & Chr$(bar_pos) 'Position of HRI characters
printBarcode = printBarcode & Chr$(GS) & "k" & Chr$(69) & Chr$(20) 'Print Barcode Symbology 39
printBarcode = printBarcode & msg & Chr$(0) & vbCrLf
printBarcode = printBarcode & Chr$(GS) & "d" & Chr$(3) & vbCrLf
printBarcode = printBarcode & Chr$(GS) & "@"
End Function
Sub printROBOT.LKORG()
Str = getBarcodeStr(80, 1, 0, 2, "*ROBOT.LK*")
ret = IODR.WriteData(Str, Len(Str))
End Sub

See also:
ESC/POS printer source code at https://robot.lk/viewtopic.php?f=39&t=874
ESC/POS Customer Display source code at https://robot.lk/viewtopic.php?f=39&t=875
Point of Sale printer/drwer and Customer Display source code at https://robot.lk/viewtopic.php?f=39&t=876