[reportlab-users] Size of Barcodes in Reportlab
Tim Roberts
timr at probo.com
Mon Nov 17 16:10:53 EST 2008
Jürgen Geuter wrote:
> Hello.
>
> I am trying to generate barcodes with reportlab and it works quite well:
> ---- example code -----
> from reportlab.pdfgen import canvas
> from reportlab.lib.pagesizes import A4,landscape
> from reportlab.graphics.barcode import code39
> from reportlab.lib.units import mm
>
> c = canvas.Canvas("/tmp/barcode.pdf", pagesize=landscape(A4))
> barcode = code39.Extended39("123456")
> barcode.drawOn(c,100*mm,100*mm)
>
> c.showpage()
> c.save()
> ---------------------------
>
> This draws a correct barcode to the position I wanted it printed, but
> it's too small. The barcode's size is not influenced by the font or the
> current line width, I tried setting the "height" and "width" attributes
> of my barcode before calling "drawOn". Nothing would change the
> barcode's size
Use the source, Luke. ;)
The Extended39 constructor accepts a "barWidth" parameter that specifies
the base width of the smallest element. It defaults to .0075 inch.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list