Skip to main content

Python driver for IBM/Toshiba 4610 SureMark POS printers with USB interface

Project description

IBM/Toshiba 4610 SureMark

PyPI Python Release

Toshiba/IBM 4610 1NR

Python library for IBM / Toshiba 4610 SureMark POS thermal receipt printers, communicating over USB.

The library has been slop-reverse-engineered from JavaPOS, and then slop-coded into python. It's on the way to getting groomed to be a regular mediocre human-made nonsense.

Communication: Github Issues

Hardware

Model Station(s) Tested Notes
4610-1NR Receipt (thermal roll) + VID=0x04B3 PID=0x4535
4610-TI3 Receipt + Slip/DI + Check scanner - Full-featured model
Other Varies - Use IBM4610 base class

Installation

pip install py-ibm-4610

pyusb may require libusb to be installed on the system. This needs to be verified.

Also udev features must listed and verified.

Quick start

import logging
from py_ibm_4610 import IBM4610_1NR
from py_ibm_4610 import FONT_A, FONT_B, FONT_C, ALIGN_CENTER, BC_CODE39, QR_EC_H

logging.basicConfig(
    level=logging.DEBUG,
)

# Context manager opens and closes the USB connection automatically
with IBM4610_1NR() as p:
    # Modifying parameters one by one
    p.select_font(FONT_B)
    p.alignment(ALIGN_CENTER)
    p.bold(True)
    p.scale_font(width=1, height=1)
    p.text("py-ibm-4610 works!\n")
    # Print all we've got so far
    p.flush()
    # An easy way to go back to defaults
    p.reinit()
    # Modifying parameters in chain
    second_line = ("That's an example of how to use our library."
                   "The newlines are handled automatically by the printer")
    p.bold(True).text(f"{second_line}\n").bold(False)
    # Showing off with a barcode
    p.barcode(BC_CODE39, "IT-WORKS", height=50, width=4, align=ALIGN_CENTER)
    p.feed(2)
    # Print a QR Code
    url = "https://github.com/printer-stream/py-ibm-4610"
    p.qr_code(url, ec=QR_EC_H)
    p.flush()
    # Feed paper so the print get above the knife
    p.feed(10)
    # Finally cut the paper
    p.cut()

Reference page

There is a ReferencePage() class slop-coded recently. It needs to be refactored.

Usage:

from py_ibm_4610 import IBM4610_1NR, ReferencePage

with IBM4610_1NR() as p:
    ReferencePage(p).enable_all().print()

Available sections: TEXT_FORMATTING, FONT_SCALING, FONT_FACES, ALIGNMENT, FONT_COLOR, ROTATION, LINE_SPACING, FEED, TAB_STOPS, MARGINS, DOT_SPACING, CHAR_SETS, PRINT_QUALITY, BARCODES, BITMAP, PAGE_MODE, BUFFER_CONTROL, STATUS, LINE_COUNT, STATUS_SENT, ERROR_RECOVERY, FEED_BUTTON, CASH_DRAWER, BEEPER, MCT, STATISTICS.

Refer to the source code for more information. Otherwise, please submit a ticket with your question.

API overview

All command methods return self for chaining. Data is buffered until flush() is called (or cut(), which flushes automatically).

p.select_station(STATION_RECEIPT)
p.bold(True).text("Header\n").bold(False)
p.alignment(ALIGN_CENTER).text("Centered\n").alignment(ALIGN_LEFT)
p.barcode(BC_EAN13, "5901234123457", height=60)
p.feed(5)
p.cut()

Buffered workflow

This is not tested well enough, and could be unstable.

p.select_station(STATION_RECEIPT)
p.text("Line 1\n")
p.text("Line 2\n")
total_bytes = p.flush()             # sends everything at once

Printing QR Codes

QR Code printing on IBM/Toshiba 4610 from python is possible now with py-ibm-4610 and IBM4610_1NR.qr_code() method.

Refer to examples for more information.

Print QR Barcode command supported on 4610 models 1NR, 2NR, and 2CR at firmware level OF.xx or above. Command will be rejected on older model printers (4610-TIx) and on 4610-1NR/2NR/2CR that are not at level OF.xx or above.

Building from source

make build        # produces dist/py_ibm_4610-<version>-py3-none-any.whl
make install      # installs the wheel for the current user
make clean        # removes the built wheel

Notes

Reverse-engineered from the IBM JavaPOS driver (posj.jar) sourced out of a random place most probably.

License

GNU General Public License v3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_ibm_4610-1.1.0.tar.gz (70.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_ibm_4610-1.1.0-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file py_ibm_4610-1.1.0.tar.gz.

File metadata

  • Download URL: py_ibm_4610-1.1.0.tar.gz
  • Upload date:
  • Size: 70.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_ibm_4610-1.1.0.tar.gz
Algorithm Hash digest
SHA256 020a646e98e8d370cbbd5899c6f4f42104091a6b7394a4e061fcd082f96ec610
MD5 03e7f4798bf631334e0a2db458c0cf92
BLAKE2b-256 9b02692cb854f489578ba21bc0c389b387244c0ebdc8260cbc9078898793417a

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_ibm_4610-1.1.0.tar.gz:

Publisher: release.yml on printer-stream/py-ibm-4610

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_ibm_4610-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_ibm_4610-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_ibm_4610-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc1ac542431dc50d05e8495f3fc675df45f537b8315494dcc804dd385ee57ff
MD5 cdfd1e7753672a71ef0de611f569ea9c
BLAKE2b-256 e4edc216c4e0d63b585d20ed0c157164782be8598d7bd4015bf366abef483185

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_ibm_4610-1.1.0-py3-none-any.whl:

Publisher: release.yml on printer-stream/py-ibm-4610

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page