How to use the escpos.printer.Network 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 OpenPymeMx / ProxyPoS / proxypos / proxypos / controlers / printer.py View on Github external
device.pxWidth = settings['pxWidth']
            # Set default widht with normal value
            device.width = device.widthA = settings['WidthA']
            device.widthB = settings['WidthB']
            # Set correct table character
            if 'charSet' in settings:
                device.text(settings['charSet'])
            template = config.get('receipt.template')
            # Render and print receipt
            tmphandler.print_receipt(device, template, receipt)
    elif ptype == 'serial':
        # TODO:
        printer.Serial(settings['devfile'])
    elif ptype == 'network':
        # TODO:
        printer.Network(settings['host'])
github paxapos / fiscalberry / Drivers / ReceiptDirectJetDriver.py View on Github external
# -*- coding: utf-8 -*-

import socket
from escpos import printer, escpos
import threading
import time
from DriverInterface import DriverInterface


# TCP_PORT = 9100


class ReceiptDirectJetDriver(printer.Network, DriverInterface):
    connected = False

    def __init__(self, host, port=9100, timeout=10, codepage="cp858", mac="", *args, **kwargs):
        """ escrito aqui solo para tener bien en claro las variables iniciales"""
        """
        :param host : Printer's hostname or IP address
        :param port : Port to write to
        :param timeout : timeout in seconds for the socket-library
        :param codepage : codepage default to cp858
        """
        escpos.Escpos.__init__(self, *args, **kwargs)
        self.host = host
        self.port = port
        self.timeout = timeout
        self.codepage = codepage
github OpenPymeMx / ProxyPoS / proxypos / proxypos / controlers / printer.py View on Github external
def is_alive():
    from proxypos.proxypos import config
    # Init printer
    ptype = config.get('printer.type').lower()
    settings = config.get('printer.settings')
    idVendor = settings['idVendor']
    idProduct = settings['idProduct']
    if ptype == 'usb':
        with printer.Usb(idVendor, idProduct) as device:
            pass
    elif ptype == 'serial':
        # TODO:
        printer.Serial(settings['devfile'])
    elif ptype == 'network':
        # TODO:
        printer.Network(settings['host'])
github it-projects-llc / pos-addons / hw_twitter_printing / __init__.py View on Github external
def connect_to_printer(self):
        NETWORK_PRINTER_IP = config['twitter_printer_ip']
        if self.printer:
            self.printer.close()
        try:
            self.printer = Network(NETWORK_PRINTER_IP)
        except:
            _logger.error("Can not get printer with IP: %s" % NETWORK_PRINTER_IP)
            self.printer = False
github OpenPymeMx / ProxyPoS / proxypos / proxypos / controlers / printer.py View on Github external
def open_cashbox():
    from proxypos.proxypos import config
    # Init printer
    ptype = config.get('printer.type').lower()
    settings = config.get('printer.settings')
    idVendor = settings['idVendor']
    idProduct = settings['idProduct']
    if ptype == 'usb':
        with printer.Usb(idVendor, idProduct) as device:
            device.cashdraw(2)
    elif ptype == 'serial':
        # TODO:
        printer.Serial(settings['devfile'])
    elif ptype == 'network':
        # TODO:
        printer.Network(settings['host'])