[reportlab-users] How to add astrerisks to barcodes in reportlab

Tim Roberts timr at probo.com
Fri Mar 22 15:29:47 EDT 2013

Mike Driscoll wrote:


> I was trying out the builtin barcode generating functions of Reportlab

> today in the hopes that I could replace the font we're currently

> embedding in our PDFs with just Python code. Right now, we're using a

> "code 3 of 9" barcode font to create our barcodes in Reportlab. The

> barcodes encode strings that look something like this (minus the

> quotes): "*123456789*".


> I thought I could use code39 from reportlab.graphics.barcode to do

> the same thing, but I just get a blank area where the barcode should

> be. If I remove the asterisks, it works. I tried a few of the other

> barcode types, but the same thing happens with them. Does anyone have

> any insights?

* is the start and stop code. You request that by adding "stop=1" when
you create the barcode object instance. Because of the way the checksum
table is implemented, you can't include it in the string.

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the reportlab-users mailing list