[reportlab-users] qr example
Robin Becker
robin at reportlab.com
Thu Oct 14 04:54:12 EDT 2010
On 14/10/2010 06:44, Martin Weissenboeck wrote:
> Is there a short complete example to use the new QRCode class in ReportLab
> 2.5?
> I have read "http://www.reportlab.com/docs/reportlab-graphics-reference.pdf"
> Sorry, I don't know what I have to import or where to get the "PlotArea"
>
you don't need to know about the inheritance really that's a silliness of the
document generator.
Try this for starters
#############################################
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.barcode.qr import QrCodeWidget
qrw = QrCodeWidget('hello cruel world!')
b = qrw.getBounds()
w=b[2]-b[0]
h=b[3]-b[1]
d = Drawing(360,360,transform=[360./w,0,0,360./h,0,0])
d.add(qrw)
d.save(formats=['pdf','gif'],outDir='.',fnRoot='QR')
#############################################
--
Robin Becker
More information about the reportlab-users
mailing list