Generator of printable binary files with helper methods based on ESC/POS protocol
Project description
escpos_gen
Description
Generator of printable binary files with helper methods based on ESC/POS protocol.
Methods to:
- Create tables providing data and table format.
- Set text format in ESC/POS protocol.
- Open drawer.
- Ring buzzer.
- Print text.
- Predefined horizontal lines.
- Get ESC/POS commands to print images.
- Generate ESC/POS printable binary file.
Supports spanish characters.
Instalation
Run the following to install:
pip install escpos_gen
Usage
from escpos_gen import escGenerator
a = escGenerator()
options = {
"columns":[
{
"text": "Cant",
"type": "data",
"header_align": "center",
"data_align": "left"
},
{
"text": "Descripción",
"type": "fill",
"header_align": "center",
"data_align": "left",
"data_fill_car": " "
},
{
"text": "Precio",
"type": "data",
"header_align": "center",
"data_align": "right"
}
],
"show_headers": True,
"show_data": True,
"border_top" : False,
"border_right" : False,
"border_bottom" : True,
"border_left" : False,
"separate_header": True,
"separate_cols": True,
"separate_rows": False,
"row_separator_style": "blank-dashed",
"style": "blank-line",
"table_align": "center"
}
data = [
["1", "Hamburguesa con papas y mucho aguacate porfavor", "$50.00"],
["1", "Cocacola ", "$10.00"],
["1", "Sprite", "$10.00"],
["2", "Tacos barbacoa", "$24.00"],
["1", "Torta ahogada", "$23.00"],
["2", "Torta ahogada", "$23.00"],
["3", "Torta ahogada", "$23.00"],
["4", "Torta ahogada", "$23.00"]
]
a.table(data, options)
data_to_print = a.generate()
str_dev_printer = f"/dev/usb/lp2"
dev_printer = open(str_dev_printer, 'wb')
dev_printer.write(data_to_print)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
escpos_gen-0.0.2.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file escpos_gen-0.0.2.tar.gz
.
File metadata
- Download URL: escpos_gen-0.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84aa2084da2c9fb5d9ebeea62b365230507146462a085aec95cb4b038bf19030 |
|
MD5 | a899ad600cb1ec5f10ac5f92e9d547eb |
|
BLAKE2b-256 | abc1d4b34fa7274c1ffe9b1988836d4b1e09eecd3c9e40db74e51bcb757dde22 |
File details
Details for the file escpos_gen-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: escpos_gen-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4250b82a54795addb2558ec0bc631450b9c47fc47405dc5afa49df706ad187b |
|
MD5 | 21411e2b33f1f1b8940f7f3a42d5949d |
|
BLAKE2b-256 | a200c7da94404465bbb3d8210961568fbadc027feebd1c5b059db2cede87d785 |