-4

This is vb.net.

Public GS As String = Chr(&H1D)

Public Function getBarcodeStr(ByVal msg As String) As String

    getBarcodeStr = GS & "h" & Chr(80) 'Bardcode Hieght
    getBarcodeStr = getBarcodeStr & GS & "w" & Chr(1) 'Barcode Width
    getBarcodeStr = getBarcodeStr & GS & "f" & Chr(0) 'Font for HRI characters
    getBarcodeStr = getBarcodeStr & GS & "H" & Chr(2) 'Position of HRI characters
    getBarcodeStr = getBarcodeStr & GS & "k" & Chr(69) & Chr(20) 'Print Barcode Smb 39
    getBarcodeStr = getBarcodeStr & msg & Chr(0) & vbCrLf 'Print Text Under
    getBarcodeStr = getBarcodeStr & GS & "d" & Chr(3) & vbCrLf
    getBarcodeStr = getBarcodeStr & GS & "@"
    Return getBarcodeStr
End Function

Public Sub EPOSPrinter(ByVal PrintString As String)

        RawPrinterHelper.SendStringToPrinter(My.Settings.PrinterName, PrintString)
End Sub



PrintString = getBarcodeStr("8714789570945") + vbCrLf 'Test this barcode
EPOSPrinter(PrintString)
George Simms
  • 3,930
  • 4
  • 21
  • 35
Praful Jain
  • 13
  • 1
  • 6

1 Answers1

2

Maybe try this without knowing what the other function do:

public String getBarcodeStr(String msg){        
String getBarcodeStr = GS + "h" + Chr(80); //Bardcode Hieght";
        getBarcodeStr += GS + "w" + Chr(1);// 'Barcode Width
        getBarcodeStr += GS + "f" + Chr(0);// 'Font for HRI characters
        getBarcodeStr += GS + "H" + Chr(2);// 'Position of HRI characters
        getBarcodeStr += GS + "k" + Chr(69) + Chr(20);// 'Print Barcode Smb 39
        getBarcodeStr += msg + Chr(0)+ "\n";// 'Print Text Under
        getBarcodeStr += GS + "d" & Chr(3) +"\n";
        getBarcodeStr += GS + "@";
return getBarcodeStr;
}
MrT
  • 594
  • 2
  • 17