Skip to main content

escposgen

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 escposgen

Usage

from escposgen 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)

Release files for escposgen 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for escposgen 0.0.3
File Size Uploaded
escposgen-0.0.3.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for escposgen 0.0.3
File Interpreter ABI Platform
escposgen-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size:5.4 kB

Release files / escposgen-0.0.3.tar.gz

Download URL escposgen-0.0.3.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d775b20d82618f5c21b40d3e66999bb79bbe65d78cbe3270d53548bea1d2a89f
BLAKE2b-256 checksum
How to use checksums
ce056884b50943d19473c1eb2c19eaa90e7a34df93775befc9ddaedd5059e2fc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / escposgen-0.0.3-py3-none-any.whl

Download URL escposgen-0.0.3-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c310d3b238a73acfae7b0dd351a14518bb68d702719272405d3a71f8c62fba0
BLAKE2b-256 checksum
How to use checksums
e872fac07ec4f91020bbe6452519572f082b4de846eef5db404e96612f67ac89
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page