def barcode(self, code, bc, width=255, height=2, pos='below', font='a'):
        """ Print Barcode """
        # Align Bar Code()
        self._raw(TXT_ALIGN_CT)
        # Height
        if height >=2 or height <=6:
            self._raw(BARCODE_HEIGHT)
        else:
            raise BarcodeSizeError()
        # Width
        if width >= 1 or width <=255:
            self._raw(BARCODE_WIDTH)
        else:
            raise BarcodeSizeError()
        # Font
        if font.upper() == "B":
            self._raw(BARCODE_FONT_B)
        else: # DEFAULT FONT: A
            self._raw(BARCODE_FONT_A)
        # Position
        if pos.upper() == "OFF":
            self._raw(BARCODE_TXT_OFF)
        elif pos.upper() == "BOTH":
            self._raw(BARCODE_TXT_BTH)
        elif pos.upper() == "ABOVE":
            self._raw(BARCODE_TXT_ABV)
        else:  # DEFAULT POSITION: BELOW 
            self._raw(BARCODE_TXT_BLW)
        # Type 
        if bc.upper() == "UPC-A":
            self._raw(BARCODE_UPC_A)
        elif bc.upper() == "UPC-E":
            self._raw(BARCODE_UPC_E)
        elif bc.upper() == "EAN13":
            self._raw(BARCODE_EAN13)
        elif bc.upper() == "EAN8":
            self._raw(BARCODE_EAN8)
        elif bc.upper() == "CODE39":
            self._raw(BARCODE_CODE39)
        elif bc.upper() == "ITF":
            self._raw(BARCODE_ITF)
        elif bc.upper() == "NW7":
            self._raw(BARCODE_NW7)
        else:
            raise BarcodeTypeError()
        # Print Code
        if code:
            self._raw(code)
        else:
            raise exception.BarcodeCodeError()
def barcode ( self , code , bc , width = 255 , height = 2 , pos = 'below' , font = 'a' ) : self . _raw ( TXT_ALIGN_CT ) if height >= 2 or height <= 6 : self . _raw ( BARCODE_HEIGHT ) else : raise BarcodeSizeError ( ) if width >= 1 or width <= 255 : self . _raw ( BARCODE_WIDTH ) else : raise BarcodeSizeError ( ) if font . upper ( ) == "B" : self . _raw ( BARCODE_FONT_B ) else : self . _raw ( BARCODE_FONT_A ) if pos . upper ( ) == "OFF" : self . _raw ( BARCODE_TXT_OFF ) elif pos . upper ( ) == "BOTH" : self . _raw ( BARCODE_TXT_BTH ) elif pos . upper ( ) == "ABOVE" : self . _raw ( BARCODE_TXT_ABV ) else : self . _raw ( BARCODE_TXT_BLW ) if bc . upper ( ) == "UPC-A" : self . _raw ( BARCODE_UPC_A ) elif bc . upper ( ) == "UPC-E" : self . _raw ( BARCODE_UPC_E ) elif bc . upper ( ) == "EAN13" : self . _raw ( BARCODE_EAN13 ) elif bc . upper ( ) == "EAN8" : self . _raw ( BARCODE_EAN8 ) elif bc . upper ( ) == "CODE39" : self . _raw ( BARCODE_CODE39 ) elif bc . upper ( ) == "ITF" : self . _raw ( BARCODE_ITF ) elif bc . upper ( ) == "NW7" : self . _raw ( BARCODE_NW7 ) else : raise BarcodeTypeError ( ) if code : self . _raw ( code ) else : raise exception . BarcodeCodeError ( )
Print Barcode