How to use the escpos.printer function in escpos

To help you get started, we’ve selected a few escpos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-escpos / python-escpos / test / test_function_set.py View on Github external
def test_default_values():
    instance = printer.Dummy()
    instance.set()

    expected_sequence = (
        TXT_NORMAL, TXT_STYLE['size']['normal'],  # Normal text size
        TXT_STYLE['flip'][False],  # Flip OFF
        TXT_STYLE['smooth'][False],  # Smooth OFF
        TXT_STYLE['bold'][False],  # Bold OFF
        TXT_STYLE['underline'][0],  # Underline OFF
        SET_FONT(b'\x00'),  # Default font
        TXT_STYLE['align']['left'],  # Align left
        TXT_STYLE['invert'][False]  # Inverted OFF
    )

    assert(instance.output == b''.join(expected_sequence))
github python-escpos / python-escpos / test / test_function_panel_button.py View on Github external
def test_function_panel_button_off():
    """test the panel button function (disabling) by comparing output"""
    instance = printer.Dummy()
    instance.panel_buttons(False)
    assert(instance.output == b'\x1B\x63\x35\x01')
github python-escpos / python-escpos / test / test_function_image.py View on Github external
def test_bit_image_transparent():
    """
    Test printing black/transparent bit image (raster)
    """
    instance = printer.Dummy()
    instance.image('test/resources/black_transparent.png', impl="bitImageRaster")
    assert(instance.output == b'\x1dv0\x00\x01\x00\x02\x00\xc0\x00')
github python-escpos / python-escpos / test / test_function_set.py View on Github external
def test_set_size_custom():
    instance = printer.Dummy()
    instance.set(custom_size=True, width=8, height=7)

    expected_sequence = (
        TXT_SIZE,  # Custom text size, no normal reset
        six.int2byte(TXT_STYLE['width'][8] + TXT_STYLE['height'][7]),
        TXT_STYLE['flip'][False],  # Flip OFF
        TXT_STYLE['smooth'][False],  # Smooth OFF
        TXT_STYLE['bold'][False],  # Bold OFF
        TXT_STYLE['underline'][0],  # Underline OFF
        SET_FONT(b'\x00'),  # Default font
        TXT_STYLE['align']['left'],  # Align left
        TXT_STYLE['invert'][False]  # Inverted OFF
    )

    assert (instance.output == b''.join(expected_sequence))