Changeset 9913 for main


Ignore:
Timestamp:
26 Jan 2013, 10:55:22 (12 years ago)
Author:
Henrik Bettermann
Message:

Render footer properly and set topMargin.

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

    r9910 r9913  
    397397
    398398    def create_pdf(self, data, headerline=None, title=None, author=None,
    399                    footer='', note=None, sigs_in_footer=[]):
     399                   footer='', note=None, sigs_in_footer=[], topMargin=1.5):
    400400        """Returns a binary data stream which is a PDF document.
    401401        """
     
    405405            pdf_stream,
    406406            bottomMargin=bottomMargin,
    407             topMargin=1.5*inch,
     407            topMargin=topMargin*inch,
    408408            title=title,
    409409            pagesize=portrait(A4),
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9912 r9913  
    551551                  tableheader_2=None, tabledata_2=None,
    552552                  note=None, signatures=None, sigs_in_footer=(),
    553                   show_scans=True):
     553                  show_scans=True, topMargin=1.5):
    554554        """Render pdf slips for various pages.
    555555        """
     
    560560        author = '%s (%s)' % (view.request.principal.title,
    561561                              view.request.principal.id)
    562         footer_text = view.label.split('\n')[0]
     562        footer_text = view.label.split('\n')
     563        if len(footer_text) > 2:
     564            # We can add a department in first line
     565            footer_text = footer_text[1]
     566        else:
     567            # Onle the first line is used for the footer
     568            footer_text = footer_text[0]
    563569        if getattr(student, 'student_id', None) is not None:
    564570            footer_text = "%s - %s - " % (student.student_id, footer_text)
     
    620626            pdf_stream = creator.create_pdf(
    621627                data, None, doc_title, author=author, footer=footer_text,
    622                 note=note, sigs_in_footer=sigs_in_footer)
     628                note=note, sigs_in_footer=sigs_in_footer, topMargin=topMargin)
    623629        except IOError:
    624630            view.flash('Error in image file.')
Note: See TracChangeset for help on using the changeset viewer.