Changeset 10595 for main/waeup.kofa/trunk/src
- Timestamp:
- 6 Sep 2013, 13:12:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r10571 r10595 24 24 from cStringIO import StringIO 25 25 from datetime import datetime 26 from reportlab.graphics.barcode.qr import QrCodeWidget 27 from reportlab.graphics.shapes import Drawing 26 28 from reportlab.lib import colors 27 29 from reportlab.lib.units import cm, inch, mm … … 39 41 from waeup.kofa.interfaces import IKofaUtils 40 42 from waeup.kofa.interfaces import MessageFactory as _ 43 41 44 42 45 #: A reportlab paragraph style for 'normal' output. … … 850 853 grok.name('landscape') 851 854 pagesize = landscape(A4) 855 856 def get_qrcode(text, width=60.0): 857 """Get a QR Code as Reportlab Flowable (actually a `Drawing`). 858 859 `width` gives box width in pixels (I think) 860 """ 861 widget = QrCodeWidget(text) 862 bounds = widget.getBounds() 863 w_width = bounds[2] - bounds[0] 864 w_height = bounds[3] - bounds[1] 865 drawing = Drawing( 866 width, width, 867 transform=[width/w_width, 0, 0, width/w_height, 0, 0]) 868 drawing.add(widget) 869 return drawing
Note: See TracChangeset for help on using the changeset viewer.