Python3 reportlab code 39 adding an extra character

Using python3 and reportlab, I am trying to create two barcode columns:

from reportlab.graphics.barcode import code39
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas

c = canvas.Canvas("barcode_example.pdf", pagesize=A4)

code_list = [
    'E100', 'RA100', 
    'E101', 'RA101', 
    'E102', 'RA102', 
    'E103', 'RA103', 
    'E104', 'RA104',
    'E105', 'RA105', 
    'E106', 'RA106', 
    'E107', 'RA107', 
    'E108', 'RA108', 
    'E109', 'RA109']
x = 1 * mm
y = 278 * mm
x1 = 6.4 * mm

for i, code in enumerate(code_list):
    barcode = code39.Extended39(code, barWidth=0.6*mm, barHeight=15*mm)

    if i % 2 == 0:
        barcode.drawOn(c, x, y)
        x1 = x + 6.4 * mm
        c.drawString(x1, y- 5 * mm, code)
    else:
        x1 = x + 100 * mm
        barcode.drawOn(c, x1, y)
        y = y - 5 * mm
        c.drawString(x1 + 6.4 * mm, y, code)
        y = y - 25 * mm


#    if int(y) == 0:
#        x = x + 50 * mm
#        y = 285 * mm

c.showPage()
c.save()

It generates a file and seems to be just fine, but after scanning them using a barcode scanner they are read as follows:

E100F   RA100 
E101G   RA101$
E102H   RA102/
E103I   RA103+
E104J   RA104%
E105K   RA1050
E106L   RA1061
E107M   RA1072
E108N   RA1083
E109O   RA1094

RA100 has a space after it. This clearly goes in ASCII priority order, I just don't know why. Is there a parameter that I can enable / disable?

Also, this is definitely not a barcode scanner, I reset it to read the code39 and tested it on other non-reportlab generated barcodes, and they worked fine.

Thank you for your help!

Also, I changed the code here: https://stackoverflow.com/questions/2179269/python-barcode-generation-library

Edit 128, . , -, code39

2: . - . reportlab . , - .

:

barcode = code39.Extended39(code, barWidth=0.6*mm, barHeight=15*mm, checksum=0)

checksum = False, , , , , 1 0 true/false , .

+4

Source: https://habr.com/ru/post/1538812/


All Articles