Skip to content

crisconru/escpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

escpy

Is an implementation of the ESCPOS protocol to use with thermal printer

Usage

First of all you should import the module

from escpos import ESCPOS
esc = ESCPOS()

Then you have 3 different option to send an ESCPOS command. We are going to send the same command, print the text in buffer and then 4 feed lines

  1. ASCII mode
# Ex: ESC d 4
esc_in_bytes = esc.ascii_command('ESC', 'd', 4)
  1. HEX mode
# Ex: 1B 64 04
esc_in_bytes = esc.hex_command('1B', '64', '04')
  1. DEC mode
# Ex: 27 100 4
esc_in_bytes = esc.dec_command(27, 100, 4)

You can also transform text with

# Ex: Lorem ipsum ...
esc_in_bytes = esc.string_to_escpos('Lorem ipsum...')

About

Is an implementation of the ESCPOS protocol to use with thermal printer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages