sohotcall

Thermal Printer Python Set Heating, B font, and Cut

May 2nd, 2019
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> import serial
  2. >>> ser = serial.Serial( '/dev/ttyUSB0', baudrate=9600 )
  3.  
  4. >>> ser.write( b"\x1B\x37" + bytes( [ 7, 160, 4 ] ) )
  5. 160 means 160x10us heating time, minimum 3 means 30us, default 80 means 800us
  6. 4 means 40us heating interval, default 2 means 20s
  7.  
  8. >>> ser.write( b"\x1B\x21" + bytes( [ 1 ] ) )
  9. 1 means condensed B font (42 chars/line), default 0 means normal A font (32 chars/line)
  10.  
  11. >>> ser.write( b"\x1D\x56\x00" )
  12. Cut paper, print minimum two empty lines before.
  13. Empty line = space + linefeed.
RAW Paste Data