EAN8.py revision 040e298be5b23e77e33309d65449072183c82d5c
'''
Copyright (C) 2007 Martin Owens
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
import sys
leftMap = [ '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011' ]
rightMap = [ '1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100' ]
guardBar = '202';
centerBar = '02020';
result = ''
# Rejig the label for use
sys.stderr.write("Can not encode '" + number + "' into EAN8 Barcode, Size must be 7 or 8 Numbers only\n")
i = 0
if i >= 4:
else:
i = i + 1
if i == 4:
return result;
weight = 0;
i = 0;
i = i + 1
if weight == 10:
weight = 0
return result