[reportlab-users] For Generating Multiple QR code o a pdf

86 views
Skip to first unread message

Vaibhav Gajengi

unread,
Dec 19, 2013, 1:08:14 PM12/19/13
to reportl...@lists2.reportlab.com
 
Hello Vaibhav here,

 I want to generate the multiple QR Code on a single pdf file ??
 Can anybody help me in this regards ?? some one posted on internet this code snap
  
    qrw = QrCodeWidget('tokenitem')
    print repr(qrw)
        b = qrw.getBounds()
    w=b[2]-b[0]
    h=b[3]-b[1]
    d = Drawing(100,100,transform=[110./w,0,0,110./h,0,0])
    d.add(qrw)

 



Thanks
Vaibhav

Vaibhav Gajengi

unread,
Dec 19, 2013, 1:09:40 PM12/19/13
to reportl...@lists2.reportlab.com
Could you tel me plz the above Drawing function related to the QRCode ??


Br
Vaibhav

Tim Roberts

unread,
Dec 19, 2013, 1:45:44 PM12/19/13
to reportlab-users
There's one more important step after this:
renderPDF.draw( d, canvas, x, y )

Did you actually try this? The QrCodeWidget generates a series of
graphics.shapes.Groups. The graphics.shapes.Drawing object is a
container for those shape Groups. The (100,100) is the size of the
drawing surface in pixels, and the transform parameters make sure the QR
code is scaled to fit into that size. Then, the renderPDF.draw line
places that drawing on the canvas, at the (x,y) location in the
renderPDF.draw call.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

Vaibhav Gajengi

unread,
Dec 20, 2013, 12:06:19 AM12/20/13
to reportlab-users, ti...@probo.com

Hello Tim,

Thanks for your reply.
Yes i tried with the renderPDF.draw(d,canvas,x,y).
but my problem is when i am calling the renderPDF.draw for each QRCode it rendering the QRImage on different pages in PDF.
my requirement is that i want the qr images on a single page in PDF File.
Can i call the renderPDF.draw for multiple times ??
or is there is any other way to solve the above problem ??
please find attachment for PDF i want to place the qr code in rectangles which i drawn in pdf but the QRCodes are getting drawn on different pages in PDF File.

Thanks..


Best Regards
Vaibhav

Tim Roberts

unread,
Dec 20, 2013, 12:20:24 PM12/20/13
to Support list for users of Reportlab software
Vaibhav Gajengi wrote:
>
> Thanks for your reply.
> Yes i tried with the renderPDF.draw(d,canvas,x,y).
> but my problem is when i am calling the renderPDF.draw for each QRCode
> it rendering the QRImage on different pages in PDF. my requirement is
> that i want the qr images on a single page in PDF File.
> Can i call the renderPDF.draw for multiple times ??
> or is there is any other way to solve the above problem ??
> please find attachment for PDF i want to place the qr code in
> rectangles which i drawn in pdf but the QRCodes are getting drawn on
> different pages in PDF File.

There was nothing attached to your message, but you're going to need to
show us your code somehow. renderPDF.draw should not eject the page. If
you are calling c.showPage() after each call to draw, then you should
be embarrassed that you didn't see the problem yourself.

Vaibhav Gajengi

unread,
Dec 22, 2013, 7:43:56 AM12/22/13
to reportlab-users, Tim Roberts
Hello Tim,

Your help solved my problem its working for me. 
Thanks..



Best Regards
Vaibhav
Reply all
Reply to author
Forward
0 new messages