zprinter.py
def create_binary_qr(data, scale, version=None, include_qz=True, debug=False):
    """ Create a binary image of a QR code

    Args:
        data <str>: Information to be encoded into a QR code.
        scale <int>: A multiplier to scale the size of the QR code.
        version <None> or <int>: If None then pyqrcode will determine
            the minimum required QR code version. If an integer, a
            QR code of this version will be called. Version must be
            between 1 and 40.
        include_qz <boolean>: If set to False the quiet zone will be
            removed. This option can be used if you want to position the
            QR code manually and dictate your own quiet zone size.

    Raises:

    """
    qr = pyqrcode.create(data, error="H", version=version)

    # Obtain a binary representation of the QR code
    qr_text = qr.text()
    # Remove leading or trailing line breaks and spaces
    qr_text = qr_text.strip()
    # Invert the image
    qr_text = qr_text.replace("1", "A").replace("0", "1").replace("A", "0")
    # Break up into a list of rows
    qr_text = qr_text.split("\n")

    # Increase the size of the barcode as pyqrcode provides a binary
    # version with 1x1 modules. However, do not scale the quiet
    # zones.
    skip_count = 0
    for row in qr_text:
        if "0" not in row:
            skip_count += 1

    if include_qz:
        qz_index = int((skip_count / 2) - 1)
    else:
        qz_index = int(skip_count / 2)

    binary_data = []
    for row in qr_text[qz_index:-qz_index]:
        new_row = ""
        for char in row[qz_index:-qz_index]:
            new_row += char * scale
        for n in range(scale):
            binary_data.append(new_row)

    # Convert the QR Code data into a format compatible with the
    # 'GW' EPL2 command binary image printing method.
    byte_string = binary_to_byte_string(binary_data, debug)

    return(binary_data, byte_string)
 Create a binary image of a QR code

    Args:
        data <str>: Information to be encoded into a QR code.
        scale <int>: A multiplier to scale the size of the QR code.
        version <None> or <int>: If None then pyqrcode will determine
            the minimum required QR code version. If an integer, a
            QR code of this version will be called. Version must be
            between 1 and 40.
        include_qz <boolean>: If set to False the quiet zone will be
            removed. This option can be used if you want to position the
            QR code manually and dictate your own quiet zone size.

    Raises:

    
Create a binary image of a QR code
Args:
data : Information to be encoded into a QR code.
scale : A multiplier to scale the size of the QR code.
version  or : If None then pyqrcode will determine
the minimum required QR code version. If an integer, a
QR code of this version will be called. Version must be
between 1 and 40.
include_qz : If set to False the quiet zone will be
removed. This option can be used if you want to position the
QR code manually and dictate your own quiet zone size.


Create a binary image of a QR code Args : data : Information to be encoded into a QR code . scale : A multiplier to scale the size of the QR code . version or : If None then pyqrcode will determine the minimum required QR code version . If an integer a QR code of this version will be called . Version must be between 1 and 40 . include_qz : If set to False the quiet zone will be removed . This option can be used if you want to position the QR code manually and dictate your own quiet zone size .
def create_binary_qr(data, scale, version=None, include_qz=True, debug=False):
    qr = pyqrcode.create(data, error="H", version=version)
    qr_text = qr.text()
    qr_text = qr_text.strip()
    qr_text = qr_text.replace("1", "A").replace("0", "1").replace("A", "0")
    qr_text = qr_text.split("\n")
    skip_count = 0
    for row in qr_text:
        if "0" not in row:
            skip_count += 1
    if include_qz:
        qz_index = int((skip_count / 2) - 1)
    else:
        qz_index = int(skip_count / 2)
    binary_data = []
    for row in qr_text[qz_index:-qz_index]:
        new_row = ""
        for char in row[qz_index:-qz_index]:
            new_row += char * scale
        for n in range(scale):
            binary_data.append(new_row)
    byte_string = binary_to_byte_string(binary_data, debug)
    return(binary_data, byte_string)
def create_binary_qr ( data , scale , version = None , include_qz = True , debug = False ) : qr = pyqrcode . create ( data , error = "H" , version = version ) qr_text = qr . text ( ) qr_text = qr_text . strip ( ) qr_text = qr_text . replace ( "1" , "A" ) . replace ( "0" , "1" ) . replace ( "A" , "0" ) qr_text = qr_text . split ( "\n" ) skip_count = 0 for row in qr_text : if "0" not in row : skip_count += 1 if include_qz : qz_index = int ( ( skip_count / 2 ) - 1 ) else : qz_index = int ( skip_count / 2 ) binary_data = [ ] for row in qr_text [ qz_index : - qz_index ] : new_row = "" for char in row [ qz_index : - qz_index ] : new_row += char * scale for n in range ( scale ) : binary_data . append ( new_row ) byte_string = binary_to_byte_string ( binary_data , debug ) return ( binary_data , byte_string )
Create a binary image of a QR code
Args:
data <str>: Information to be encoded into a QR code.
Create a binary image of a QR code Args : data <str > : Information to be encoded into a QR code .
""" Create a binary image of a QR code

    Args:
        data <str>: Information to be encoded into a QR code.
        scale <int>: A multiplier to scale the size of the QR code.
        version <None> or <int>: If None then pyqrcode will determine
            the minimum required QR code version. If an integer, a
            QR code of this version will be called. Version must be
            between 1 and 40.
        include_qz <boolean>: If set to False the quiet zone will be
            removed. This option can be used if you want to position the
            QR code manually and dictate your own quiet zone size.

    Raises:

    """ # Obtain a binary representation of the QR code # Remove leading or trailing line breaks and spaces # Invert the image # Break up into a list of rows # Increase the size of the barcode as pyqrcode provides a binary # version with 1x1 modules. However, do not scale the quiet # zones. # Convert the QR Code data into a format compatible with the # 'GW' EPL2 command binary image printing method.
data
scale
version
include_qz
debug