Changeset 9547 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 6 Nov 2012, 00:05:27 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r9452 r9547 203 203 204 204 @classmethod 205 def _drawSignatureBoxes(cls, canvas, width, height, signatures=[]): 206 """Draw signature boxes into canvas. 207 """ 208 canvas.saveState() 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) 218 canvas.restoreState() 219 return canvas 220 221 @classmethod 205 222 def fromStringList(cls, string_list): 206 223 """Generate a list of reportlab paragraphs out of a list of strings. … … 344 361 # Footer 345 362 canvas.saveState() 363 if getattr(doc, 'sig_in_footer', False): 364 self._drawSignatureBoxes(canvas, width, height) 346 365 canvas.line(2.2*cm, 0.62*inch, width-2.2*cm, 0.62*inch) 347 366 canvas.setFont("Helvetica", 9) … … 365 384 366 385 def create_pdf(self, data, headerline=None, title=None, author=None, 367 footer='', note=None ):386 footer='', note=None, sig_in_footer=False): 368 387 """Returns a binary data stream which is a PDF document. 369 388 """ 370 389 pdf_stream = StringIO() 390 bottomMargin = sig_in_footer and 1.4*inch or 0.8*inch 371 391 doc = SimpleDocTemplate( 372 392 pdf_stream, 373 bottomMargin= 1.1*inch,393 bottomMargin=bottomMargin, 374 394 topMargin=1.3*inch, 375 395 title=title, … … 383 403 doc.kofa_author = author 384 404 doc.kofa_footer = footer 405 doc.sig_in_footer = sig_in_footer 385 406 if note is not None: 386 407 html = format_html(note) -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9532 r9547 506 506 def renderPDF(self, view, filename='slip.pdf', student=None, 507 507 studentview=None, tableheader=None, tabledata=None, 508 note=None, signatures=None ):508 note=None, signatures=None, sig_in_footer=False): 509 509 """Render pdf slips for various pages. 510 510 """ … … 557 557 558 558 # Insert signatures 559 if signatures :559 if signatures and not sig_in_footer: 560 560 data.append(Spacer(1, 20)) 561 561 signaturetable = get_signature_table(signatures) … … 567 567 pdf_stream = creator.create_pdf( 568 568 data, None, doc_title, author=author, footer=footer_text, 569 note=note )569 note=note, sig_in_footer=sig_in_footer) 570 570 except IOError: 571 571 view.flash('Error in image file.')
Note: See TracChangeset for help on using the changeset viewer.