[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5979 - trunk/gnue-common/src/printing/barcodes
From: |
jcater |
Subject: |
r5979 - trunk/gnue-common/src/printing/barcodes |
Date: |
Wed, 14 Jul 2004 16:55:53 -0500 (CDT) |
Author: jcater
Date: 2004-07-14 16:55:53 -0500 (Wed, 14 Jul 2004)
New Revision: 5979
Modified:
trunk/gnue-common/src/printing/barcodes/postnet.py
Log:
corrections to the postnet check digit algorithm (it wasn't modulo-10); postnet
has been verified against samples from the usps now.
Modified: trunk/gnue-common/src/printing/barcodes/postnet.py
===================================================================
--- trunk/gnue-common/src/printing/barcodes/postnet.py 2004-07-14 21:06:58 UTC
(rev 5978)
+++ trunk/gnue-common/src/printing/barcodes/postnet.py 2004-07-14 21:55:53 UTC
(rev 5979)
@@ -54,7 +54,7 @@
lineWidth = 1.44 # points
lineHeight = 8.5 # (.125")
- spaceWidth = 1.66
+ spaceWidth = 1.9 #1.66
encodingMap = {
# Stroke?, X Multiplier, Y Multiplier
@@ -75,7 +75,10 @@
v += int(ch)
except ValueError:
raise InvalidBarcode
- return self.chars[divmod(v,10)[1]]
+ cd = abs(10-divmod(v,10)[1])
+ if cd == 10:
+ cd = 0
+ return self.chars[cd]
if __name__ == '__main__':
@@ -89,6 +92,6 @@
# test('381072456','png','test1.png')
# test('381172459','tiff','test1.tif')
- test('123456789','eps','postnet-1.eps')
+ test('383759907','eps','postnet-1.eps')
test('12345','eps','postnet-2.eps')
test('12345678901','eps','postnet-3.eps')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5979 - trunk/gnue-common/src/printing/barcodes,
jcater <=