[reportlab-users] Performance Issue generating multiple QR codes

Thomas Kremmel thomasspin at gmail.com
Wed Sep 17 07:38:29 EDT 2014


I'm using Reportlab to generate a pdf with 10 pages. I print on each page a
QR code, which is about half the size of the A4 page.

The generation of the .pdf takes me about 20 seconds.
When I generate the .pdf without the QR codes the .pdf is generated
immediately. Thus it is obvious that the pdf generation of the QR codes
consumes the most time.

Any idea what I could do here to bring this down to an user acceptable time
- say 2 seconds.

Here are some source snippets to get an idea what I'm doing.

import from reportlab.graphics.barcode.qr import QrCodeWidget

 def draw_qr_code(self):
        qr_code_data = get_qr_code_data("input text")
        qrw = QrCodeWidget(qr_code_data, barLevel='M')
        b = qrw.getBounds()
        d = Drawing(220, 220, transform=[220./w, 0, 0, 220./h, 115, 0])

    def drawing(self, drawing):

     def generate(self):
        # this consumes about 18 of the 20 seconds..

Would be great if someone could shed some light on this topic.
All the best,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20140917/32b99600/attachment.html>

More information about the reportlab-users mailing list