zprinter.py
def encode_binary_image(self, byte_string, width_dot, length_dot, start_x=0, start_y=0):
        """
        'GW' Command: Direct graphic write. Send the printer a string
                      of bytes where 0 represents black and 1 represents
                      white.
            binary_data = A list of strings, where each string is a
                          binary number of equal length to each other.
                          The length of each string will translate to
                          the width of the image. The number of rows in
                          the list translates to the height of the
                          image.
            start_x = horizontal start position, in dots
            start_y = vertical start position, in dots
        """
        start_x = int(start_x) + ((self.label_width_dot + self.label_gap_dot) * self.active_column) + self.x_offset_dot
        if start_x < 0:
            start_x = 0
            # print("WARNING: barcode x position can't be negative so it has been forced to 0")

        # The offset is negative because the printer origin is top-left
        # whereas most users will intuitively expect bottom-left. If
        # negative, a positive offset will actually shift the object up.
        start_y = int(start_y) - self.y_offset_dot
        if start_y < 0:
            start_y = 0
            # print("WARNING: barcode y position can't be negative so it has been forced to 0")

        width_bytes = int(width_dot / 8)

        # Format: GW<start_x>,<start_y>,<width>,<length>\data\n
        # start_x (in dots)
        # start_y (in dots)
        # width (in bytes)
        # length (in dots)
        # data = A continuous string of raw bytes represented in hex
        #   e.g. 'F0F6F6F0' with width=2 will draw a (very small) box.
        #        However, the hex string must represented raw bytes.
        #        when sent to the printer e.g b'\xf0\xf6\xf6\xf0'
        image = ('GW{},{},{},{}\n{}\n'
                 .format(start_x, start_y, width_bytes, length_dot, byte_string))
        self.command += image

        'GW' Command: Direct graphic write. Send the printer a string
                      of bytes where 0 represents black and 1 represents
                      white.
            binary_data = A list of strings, where each string is a
                          binary number of equal length to each other.
                          The length of each string will translate to
                          the width of the image. The number of rows in
                          the list translates to the height of the
                          image.
            start_x = horizontal start position, in dots
            start_y = vertical start position, in dots
        
'GW' Command: Direct graphic write. Send the printer a string
of bytes where 0 represents black and 1 represents
white.
binary_data = A list of strings, where each string is a
binary number of equal length to each other.
The length of each string will translate to
the width of the image. The number of rows in
the list translates to the height of the
image.
start_x = horizontal start position, in dots
start_y = vertical start position, in dots
' GW ' Command : Direct graphic write . Send the printer a string of bytes where 0 represents black and 1 represents white . binary_data = A list of strings where each string is a binary number of equal length to each other . The length of each string will translate to the width of the image . The number of rows in the list translates to the height of the image . start_x = horizontal start position in dots start_y = vertical start position in dots
def encode_binary_image(self, byte_string, width_dot, length_dot, start_x=0, start_y=0):
        start_x = int(start_x) + ((self.label_width_dot + self.label_gap_dot) * self.active_column) + self.x_offset_dot
        if start_x < 0:
            start_x = 0
        start_y = int(start_y) - self.y_offset_dot
        if start_y < 0:
            start_y = 0
        width_bytes = int(width_dot / 8)
        image = ('GW{},{},{},{}\n{}\n'
                 .format(start_x, start_y, width_bytes, length_dot, byte_string))
        self.command += image
def encode_binary_image ( self , byte_string , width_dot , length_dot , start_x = 0 , start_y = 0 ) : start_x = int ( start_x ) + ( ( self . label_width_dot + self . label_gap_dot ) * self . active_column ) + self . x_offset_dot if start_x < 0 : start_x = 0 start_y = int ( start_y ) - self . y_offset_dot if start_y < 0 : start_y = 0 width_bytes = int ( width_dot / 8 ) image = ( 'GW{},{},{},{}\n{}\n' . format ( start_x , start_y , width_bytes , length_dot , byte_string ) ) self . command += image
'GW' Command: Direct graphic write.
' GW ' Command : Direct graphic write .
"""
        'GW' Command: Direct graphic write. Send the printer a string
                      of bytes where 0 represents black and 1 represents
                      white.
            binary_data = A list of strings, where each string is a
                          binary number of equal length to each other.
                          The length of each string will translate to
                          the width of the image. The number of rows in
                          the list translates to the height of the
                          image.
            start_x = horizontal start position, in dots
            start_y = vertical start position, in dots
        """ # print("WARNING: barcode x position can't be negative so it has been forced to 0") # The offset is negative because the printer origin is top-left # whereas most users will intuitively expect bottom-left. If # negative, a positive offset will actually shift the object up. # print("WARNING: barcode y position can't be negative so it has been forced to 0") # Format: GW<start_x>,<start_y>,<width>,<length>\data\n # start_x (in dots) # start_y (in dots) # width (in bytes) # length (in dots) # data = A continuous string of raw bytes represented in hex #   e.g. 'F0F6F6F0' with width=2 will draw a (very small) box. #        However, the hex string must represented raw bytes. #        when sent to the printer e.g b'\xf0\xf6\xf6\xf0'
self
byte_string
width_dot
length_dot
start_x
start_y