[reportlab-users] Problem with Numeric Barcodes

Ed Everson ed_everson at campbellcarr.co.uk
Tue Jun 6 09:05:05 EDT 2006


I am trying to output barcodes. Fairly simple requset, but having a major headache with numeric barcodes using Code128. If the barcode is a string or number with no more than 3 consecutive numbers then it seems to work OK and I can validate the output against other barcode tools. However, if the desired code includes 4 or more consecutive numbers I do not get a valid barcode returned. Long strings with 3 or less consecutive numbers seem to work OK.
 
The code I am using is below. I am using reportlab 2.0 (downloaded 26 May). Any help will be most gratefully received. If I am using it the wrong way please tell me I am a numpty and point me in the right direction. I have not been able to find any useful documentation on the barcode bits of reportlab.
 
Thanks,
 
Ed
 
from mod_python import apache
from reportlab.pdfgen.canvas import Canvas
from styles import ReportStyleSheet
from reportlab.lib.units import cm
from reportlab.platypus import Paragraph, Frame
from reportlab.graphics.barcode.code128 import Code128
from reportlab.platypus.flowables import Image
 
def jobcard(req, jobid=None):
    if jobid == None:
        req.write("Error! No ID")
    else:
        styles = ReportStyleSheet()
        styleN = styles['Normal']
        page1 = []
        page1.append(Paragraph("Job Card <i>"+jobid+"</i>.", styleN))
        bc = Code128(value = jobid, barWidth = 1, barHeight = 30, lquiet = 5, rquiet = 5)
        page1.append(bc)
        page1.append(Paragraph(jobid, styleN))
        c = Canvas("JC-"+jobid+".pdf")
        frame1 = Frame(cm, cm, 19*cm, 27.7*cm, showBoundary=1)
        frame1.addFromList(page1,c)
        c.showPage()
        c.save()
        req.write("OK")
    return apache.OK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060606/f6724504/attachment.html


More information about the reportlab-users mailing list