def barcode(self, code, type='CODE128'): """Print barcode (type: CODE128, CODE39, EAN13, etc.)""" if type == 'CODE128': self._write(b'\x1D\x6B\x49' + bytes([len(code)]) + code.encode() + b'\x00') elif type == 'CODE39': self._write(b'\x1D\x6B\x04' + code.encode() + b'\x00') else: raise ValueError("Unsupported barcode type")
: Plug the printer into your computer using the supplied USB cable and power it on.
: Complete the installation and print a test page to verify the connection. Quick Specs for Configuration Xprinter XP-N160II Thermal Receipt Printer User Manual