The likely solution will be to adopt the standard ESC/POS
believe that all thermal printers adopt this standard.
From experience, EPSON, ELGIN, BEMATECH, I have already tested, obviously some commands of this standard can apply to one model and another not, for example, paper cutting only works on a guillotine printer.
Here's a Example Usage
Documentation: Here
Code snippet (Full example in the link above):
Public Class Form1
Public Const eClear As String = Chr(27) + "@"
Public Const eCentre As String = Chr(27) + Chr(97) + "1"
Public Const eLeft As String = Chr(27) + Chr(97) + "0"
Public Const eRight As String = Chr(27) + Chr(97) + "2"
Public Const eDrawer As String = eClear + Chr(27) + "p" + Chr(0) + ".}"
Public Const eCut As String = Chr(27) + "i" + vbCrLf
Public Const eSmlText As String = Chr(27) + "!" + Chr(1)
Public Const eNmlText As String = Chr(27) + "!" + Chr(0)
Public Const eInit As String = eNmlText + Chr(13) + Chr(27) + _
"c6" + Chr(1) + Chr(27) + "R3" + vbCrLf
Public Const eBigCharOn As String = Chr(27) + "!" + Chr(56)
Public Const eBigCharOff As String = Chr(27) + "!" + Chr(0)
Private prn As New RawPrinterHelper
Private PrinterName As String = "EPSON TM-T20 Receipt"
Public Sub StartPrint()
prn.OpenPrint(PrinterName)
End Sub
Public Sub PrintHeader()
Print(eInit + eCentre + "My Shop")
Print("Tel:0123 456 7890")
Print("Web: www.????.com")
Print("sales@????.com")
Print("VAT Reg No:123 4567 89" + eLeft)
PrintDashes()
End Sub
Public Sub PrintBody()
Print(eSmlText + "Tea T1 1.30")
PrintDashes()
Print(eSmlText + " Total: 1.30")
Print(" Paid Card: 1.30")
End Sub
Public Sub PrintFooter()
Print(eCentre + "Thank You For Your Support!" + eLeft)
Print(vbLf + vbLf + vbLf + vbLf + vbLf + eCut + eDrawer)
End Sub
Public Sub Print(Line As String)
prn.SendStringToPrinter(PrinterName, Line + vbLf)
End Sub
Public Sub PrintDashes()
Print(eLeft + eNmlText + "-".PadRight(42, "-"))
End Sub
Public Sub EndPrint()
prn.ClosePrint()
End Sub
Private Sub bnExit_Click(sender As System.Object, e As System.EventArgs) _
Handles bnExit.Click
prn.ClosePrint()
Me.Close()
End Sub
Private Sub bnPrint_Click(sender As System.Object, e As System.EventArgs) _
Handles bnPrint.Click
StartPrint()
If prn.PrinterIsOpen = True Then
PrintHeader()
PrintBody()
PrintFooter()
EndPrint()
End If
End Sub
End Class
Source: link