Changeset 9555 for main/waeup.kofa/trunk/src/waeup/kofa/browser
- Timestamp:
- 6 Nov 2012, 10:54:46 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/browser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/interfaces.py
r9546 r9555 180 180 """ 181 181 def create_pdf(data, headerline=None, title=None, author=None, 182 footer='', note=None, sig _in_footer=False):182 footer='', note=None, sigs_in_footer=[]): 183 183 """Create a PDF. 184 184 … … 196 196 page numbers. 197 197 198 `sig _in_footer`, if set to ``True`` renders signature boxes199 above the footer oneach page.198 `sigs_in_footer` is a set of translateable strings that will be 199 rendered into signature boxes at bottom of each page. 200 200 201 201 If no `headerline` is given, a default will be rendered (name -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r9547 r9555 208 208 canvas.saveState() 209 209 canvas.setFont("Helvetica", 10) 210 canvas.drawString(211 2.2*cm + 0.2*cm, 1.35 * inch,212 translate(_('Date, Student Signature')))213 canvas.drawString(214 width/2.0 + 0.15*cm + 0.4*cm, 1.35 * inch,215 translate(_('Date, Clearance Officer Signature')))216 canvas.rect(2.2*cm, 0.75*inch, width/2.0-2.1*cm, 0.75*inch)217 canvas.rect(width/2.0+0.3*cm, 0.75*inch, width/2.0-2.5*cm, 0.75*inch)210 mystring = "%r" % ([translate(sig) for sig in signatures]) 211 for num, sig in enumerate(signatures): 212 box_width = (width - 4.2*cm) / len(signatures) 213 x_box = 2.1*cm + (box_width) * num 214 y_box = 0.75*inch 215 canvas.rect(x_box+0.1*cm, y_box, box_width-0.2*cm, 0.75*inch) 216 canvas.drawString( 217 x_box+0.2*cm, 1.35*inch, translate(sig)) 218 218 canvas.restoreState() 219 219 return canvas … … 361 361 # Footer 362 362 canvas.saveState() 363 if getattr(doc, 'sig_in_footer', False): 364 self._drawSignatureBoxes(canvas, width, height) 363 if getattr(doc, 'sigs_in_footer', False): 364 self._drawSignatureBoxes( 365 canvas, width, height, doc.sigs_in_footer) 365 366 canvas.line(2.2*cm, 0.62*inch, width-2.2*cm, 0.62*inch) 366 367 canvas.setFont("Helvetica", 9) … … 384 385 385 386 def create_pdf(self, data, headerline=None, title=None, author=None, 386 footer='', note=None, sig _in_footer=False):387 footer='', note=None, sigs_in_footer=[]): 387 388 """Returns a binary data stream which is a PDF document. 388 389 """ 389 390 pdf_stream = StringIO() 390 bottomMargin = sig_in_footer and 1.4*inch or 0.8*inch391 bottomMargin = len(sigs_in_footer) and 1.9*inch or 1.2*inch 391 392 doc = SimpleDocTemplate( 392 393 pdf_stream, … … 403 404 doc.kofa_author = author 404 405 doc.kofa_footer = footer 405 doc.sig _in_footer = sig_in_footer406 doc.sigs_in_footer = sigs_in_footer 406 407 if note is not None: 407 408 html = format_html(note)
Note: See TracChangeset for help on using the changeset viewer.