How to use the escpos.barcode.gs_k_barcode 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 base4sistemas / pyescpos / escpos / impl / epson.py View on Github external
def _ean13_impl(self, data, **kwargs):
        commands = barcode.gs_k_barcode(barcode.JAN13_EAN13, data, **kwargs)
        for cmd in commands:
            self.device.write(cmd)
        time.sleep(0.25) # wait for barcode to be printed
        return self.device.read()
github base4sistemas / pyescpos / escpos / impl / epson.py View on Github external
def _code128_impl(self, data, **kwargs):
        codeset = kwargs.get('codeset', barcode.CODE128_A)
        if not is_value_in(barcode.CODE128_CODESETS, codeset):
            raise ValueError('Unknown Code 128 code set: {!r}'.format(codeset))

        encoded_data = '{{{0}{1}'.format(codeset, data) # {<data>
        commands = barcode.gs_k_barcode(barcode.CODE128, encoded_data, **kwargs)
        for cmd in commands:
            self.device.write(cmd)

        time.sleep(0.25) # wait for barcode to be printed
        return self.device.read()
</data>
github base4sistemas / pyescpos / escpos / impl / epson.py View on Github external
def _ean8_impl(self, data, **kwargs):
        commands = barcode.gs_k_barcode(barcode.JAN8_EAN8, data, **kwargs)
        for cmd in commands:
            self.device.write(cmd)
        time.sleep(0.25) # wait for barcode to be printed
        return self.device.read()