Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 7317)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 7318)
@@ -623,4 +623,5 @@
     form_fields['payment_date'].custom_widget = FriendlyDateDisplayWidget('le')
     prefix = 'form'
+    title = 'Payment Data'
 
     @property
@@ -636,5 +637,5 @@
             self.request)
         students_utils = getUtility(IStudentsUtils)
-        return students_utils.renderPDF(self,'Payment', 'payment_receipt.pdf',
+        return students_utils.renderPDF(self,'payment_receipt.pdf',
             self.context.__parent__, applicantview)
 
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7317)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7318)
@@ -90,5 +90,5 @@
     """
     grok.context(IStudentsContainer)
-    title = u'Students'
+    title = 'Students'
 
 class StudentBreadcrumb(Breadcrumb):
@@ -104,5 +104,5 @@
     """
     grok.context(IStudentStudyCourse)
-    title = u'Study Course'
+    title = 'Study Course'
 
 class PaymentsBreadcrumb(Breadcrumb):
@@ -110,5 +110,5 @@
     """
     grok.context(IStudentPaymentsContainer)
-    title = u'Payments'
+    title = 'Payments'
 
 class OnlinePaymentBreadcrumb(Breadcrumb):
@@ -125,5 +125,5 @@
     """
     grok.context(IStudentAccommodation)
-    title = u'Accommodation'
+    title = 'Accommodation'
 
     #@property
@@ -536,5 +536,7 @@
     grok.require('waeup.viewStudent')
     form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked')
+    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     prefix = 'form'
+    title = 'Clearance Data'
 
     @property
@@ -547,5 +549,5 @@
         students_utils = getUtility(IStudentsUtils)
         return students_utils.renderPDF(
-            self,'Clearance', 'clearance.pdf',
+            self, 'clearance.pdf',
             self.context.getStudent(), studentview)
 
@@ -819,4 +821,6 @@
     form_fields = grok.AutoFields(IStudentStudyLevel)
     prefix = 'form'
+    title = 'Level Data'
+    content_title = 'Course List'
 
     @property
@@ -828,6 +832,8 @@
             self.request)
         students_utils = getUtility(IStudentsUtils)
+        tabledata = sorted(self.context.values(),
+            key=lambda value: str(value.semester) + value.code)
         return students_utils.renderPDF(
-            self,'Course Registration', 'course_registration.pdf',
+            self, 'course_registration.pdf',
             self.context.getStudent(), studentview,
             tableheader=[('Sem.','semester', 1.5),('Code','code', 2.5),
@@ -838,5 +844,5 @@
                          ('Score', 'score', 1.5),('Auto', 'automatic', 1.5)
                          ],
-            tabledata=self.context.values())
+            tabledata=tabledata)
 
 class StudyLevelManageActionButton(ManageActionButton):
@@ -1255,4 +1261,5 @@
     form_fields['payment_date'].custom_widget = FriendlyDateDisplayWidget('le')
     prefix = 'form'
+    title = 'Payment Data'
 
     @property
@@ -1268,5 +1275,5 @@
             self.request)
         students_utils = getUtility(IStudentsUtils)
-        return students_utils.renderPDF(self,'Payment', 'payment_receipt.pdf',
+        return students_utils.renderPDF(self, 'payment_receipt.pdf',
             self.context.getStudent(), studentview)
 
@@ -1479,8 +1486,9 @@
     form_fields['booking_date'].custom_widget = FriendlyDateDisplayWidget('le')
     prefix = 'form'
+    title = 'Bed Allocation Data'
 
     @property
     def label(self):
-        return 'Bed Allocation %s' % self.context.bed_coordinates
+        return 'Bed Allocation: %s' % self.context.bed_coordinates
 
     def render(self):
@@ -1489,5 +1497,5 @@
         students_utils = getUtility(IStudentsUtils)
         return students_utils.renderPDF(
-            self,'Bed Allocation', 'bed_allocation.pdf',
+            self, 'bed_allocation.pdf',
             self.context.getStudent(), studentview)
 
Index: main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py	(revision 7317)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py	(revision 7318)
@@ -22,4 +22,5 @@
 from datetime import datetime
 from reportlab.pdfgen import canvas
+from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.lib.enums import TA_RIGHT
@@ -35,11 +36,22 @@
 from waeup.sirp.students.interfaces import IStudentsUtils
 
-SLIP_STYLE = TableStyle(
-    [('VALIGN',(0,0),(-1,-1),'TOP')]
-    )
-
-CONTENT_STYLE = TableStyle(
-    [('VALIGN',(0,0),(-1,-1),'TOP')]
-    )
+SLIP_STYLE = [
+    ('VALIGN',(0,0),(-1,-1),'TOP'),
+    #('FONT', (0,0), (-1,-1), 'Helvetica', 11),
+    ]
+
+CONTENT_STYLE = [
+    ('VALIGN',(0,0),(-1,-1),'TOP'),
+    #('FONT', (0,0), (-1,-1), 'Helvetica', 8),
+    #('TEXTCOLOR',(0,0),(-1,0),colors.white),
+    ('BACKGROUND',(0,0),(-1,0),colors.black),
+    ]
+
+FONT_SIZE = 10
+FONT_COLOR = 'black'
+
+def formatted_string(color=FONT_COLOR, size=FONT_SIZE):
+    tag1 ='<font color=%s size=%d>' % (color, size)
+    return tag1 + '%s</font>'
 
 def generate_student_id(students,letter):
@@ -68,6 +80,10 @@
 
 def render_student_data(studentview):
+    """Render student table for an existing frame.
+    """
+    width, height = A4
     set_up_widgets(studentview, ignore_request=True)
-    data = []
+    data_left = []
+    data_right = []
     style = getSampleStyleSheet()
     img = getUtility(IExtFileStore).getFileByContext(
@@ -76,20 +92,47 @@
         from waeup.sirp.browser import DEFAULT_PASSPORT_IMAGE_PATH
         img = open(DEFAULT_PASSPORT_IMAGE_PATH, 'rb')
-    doc_img = Image(img.name, width=4*cm, height=3*cm, kind='bound')
-    data.append([doc_img])
-    data.append([Spacer(1, 12)])
+    doc_img = Image(img.name, width=4*cm, height=4*cm, kind='bound')
+    data_left.append([doc_img])
+    #data.append([Spacer(1, 12)])
     for widget in studentview.widgets:
         if widget.name == 'form.adm_code':
             continue
-        f_label = '<font size=12>%s</font>:' % (
-            widget.label.strip())
+        f_label = formatted_string() % widget.label.strip()
         f_label = Paragraph(f_label, style["Normal"])
-        f_text = '<font size=12>%s</font>' % widget()
+        f_text = formatted_string() % widget()
         f_text = Paragraph(f_text, style["Normal"])
-        data.append([f_label,f_text])
-    table = Table(data,style=SLIP_STYLE)
+        data_right.append([f_label,f_text])
+    table_left = Table(data_left,style=SLIP_STYLE)
+    table_right = Table(data_right,style=SLIP_STYLE, colWidths=[4*cm, 10*cm])
+    table = Table([[table_left, table_right],],style=SLIP_STYLE)
     return table
 
-def insert_footer(pdf,width,style,text=None):
+def render_table_data(tableheader,tabledata):
+    """Render children table for an existing frame.
+    """
+    data = []
+    #data.append([Spacer(1, 12)])
+    line = []
+    style = getSampleStyleSheet()
+    for element in tableheader:
+        field = formatted_string(color='white') % element[0]
+        field = Paragraph(field, style["Normal"])
+        line.append(field)
+    data.append(line)
+    for ticket in tabledata:
+        line = []
+        for element in tableheader:
+              field = formatted_string() % str(getattr(ticket,element[1],u' '))
+              field = Paragraph(field, style["Normal"])
+              line.append(field)
+        data.append(line)
+    table = Table(data,colWidths=[
+        element[2]*cm for element in tableheader], style=CONTENT_STYLE)
+    return table
+
+
+def insert_footer(pdf,width,style,text=None, number_of_pages=1):
+      """Render the whole footer frame.
+      """
       story = []
       frame_footer = Frame(1*cm,0,width-(2*cm),1*cm)
@@ -100,32 +143,8 @@
       story = []
       frame_footer = Frame(1*cm,0,width-(2*cm),1*cm)
-      right_text = '<font size=10>%s Page %s</font>' % (
-          text, pdf.getPageNumber())
+      right_text = '<font size=10>%s Page %s of %s</font>' % (
+          text, pdf.getPageNumber(), number_of_pages)
       story.append(Paragraph(right_text, style["Right"]))
       frame_footer.addFromList(story,pdf)
-
-def render_table_data(tableheader,tabledata):
-    data = []
-    data.append([Spacer(1, 12)])
-    line = []
-    style = getSampleStyleSheet()
-    for element in tableheader:
-        field = '<strong><font size=10>%s</font></strong>' % element[0]
-        field = Paragraph(field, style["Normal"])
-        line.append(field)
-    data.append(line)
-    for ticket in tabledata:
-        line = []
-        for element in tableheader:
-              fieldcontent = getattr(ticket,element[1],u' ')
-              field = '<font size=10>%s</font>' % fieldcontent
-              field = Paragraph(field, style["BodyText"])
-              line.append(field)
-        data.append(line)
-    # ToDo: The table does not show up if there are too many line
-    # and it thus doesn't fit on the page
-    table = Table(data,colWidths=[
-        element[2]*cm for element in tableheader],style=CONTENT_STYLE)
-    return table
 
 class StudentsUtils(grok.GlobalUtility):
@@ -190,5 +209,5 @@
         return available_beds[0]
 
-    def renderPDF(self, view, subject='', filename='slip.pdf',
+    def renderPDF(self, view, filename='slip.pdf',
         student=None, studentview=None, tableheader=None, tabledata=None):
         # (0,0),(-1,-1) = whole table
@@ -200,5 +219,5 @@
         pdf = canvas.Canvas(filename,pagesize=A4)
         pdf.setTitle(view.label)
-        pdf.setSubject(subject)
+        pdf.setSubject(view.title)
         pdf.setAuthor('%s (%s)' % (view.request.principal.title,
             view.request.principal.id))
@@ -218,50 +237,57 @@
         frame_header.addFromList(story,pdf)
 
+        # Insert student data table
         story = []
         frame_body = Frame(1*cm,1*cm,width-(2*cm),height-(3.5*cm))
         story.append(Paragraph(view.label, style["Heading2"]))
-
-        # Insert student data table
         if student is not None:
-            story.append(Spacer(1, 12))
+            #story.append(Spacer(1, 12))
+            story.append(Paragraph('Student Base Data', style["Heading3"]))
             studenttable = render_student_data(studentview)
             story.append(studenttable)
 
-        story.append(Spacer(1, 12))
-        #story.append(PageBreak())
+        # Insert widgets
+        story.append(Paragraph(view.title, style["Heading3"]))
         set_up_widgets(view)
         data = []
         for widget in view.widgets:
-            f_label = '<font size=12>%s</font>:' % widget.label.strip()
+            f_label = formatted_string() % widget.label.strip()
             f_label = Paragraph(f_label, style["Normal"])
-            f_text = '<font size=12>%s</font>' % widget()
+            f_text = formatted_string() % str(widget())
             f_text = Paragraph(f_text, style["Normal"])
             data.append([f_label,f_text])
-        # First, import browser components locally
+        table = Table(data,style=SLIP_STYLE, colWidths=[5*cm, 13.5*cm])
+        story.append(table)
+
+        # Import browser components locally
         # to avoid circular import
         from waeup.sirp.students.viewlets import FileManager
         from waeup.sirp.browser import DEFAULT_IMAGE_PATH
+        data = []
+        # Collect viewlets
         fm = FileManager(view.context, view.request, view)
-        # Collect viewlets
         fm.update()
-        # Insert list of scanned documents
-        for viewlet in fm.viewlets:
-            f_label = '<font size=12>%s</font>' % viewlet.label
-            f_label = Paragraph(f_label, style["Normal"])
-            if viewlet.template.__grok_name__ == 'imagedisplay':
-                # In case we define FileDisplay viewlets with
-                # an imagedisplay template in the customization package
-                img = getUtility(IExtFileStore).getFileByContext(
-                    view.context, attr=viewlet.download_name)
-                if img is None:
-                    img = open(DEFAULT_IMAGE_PATH, 'rb')
-                doc_img = Image(img.name, width=2*cm, height=1*cm, kind='bound')
-                data.append([f_label,doc_img])
-            else:
-                f_text = '<font size=12>%s</font>' % viewlet.title
-                f_text = Paragraph(f_text, style["Normal"])
-                data.append([f_label,f_text])
-        table = Table(data,style=SLIP_STYLE)
-        story.append(table)
+        if fm.viewlets:
+            story.append(Paragraph('Scanned Documents', style["Heading3"]))
+            # Insert list of scanned documents
+            for viewlet in fm.viewlets:
+                f_label = formatted_string() % viewlet.label
+                f_label = Paragraph(f_label, style["Normal"])
+                if viewlet.template.__grok_name__ == 'imagedisplay':
+                    # In case we define FileDisplay viewlets with
+                    # an imagedisplay template in the customization package
+                    img = getUtility(IExtFileStore).getFileByContext(
+                        view.context, attr=viewlet.download_name)
+                    if img is None:
+                        img = open(DEFAULT_IMAGE_PATH, 'rb')
+                    doc_img = Image(img.name, width=2*cm, height=1*cm, kind='bound')
+                    data.append([f_label,doc_img])
+                else:
+                    f_text = formatted_string() % viewlet.title
+                    f_text = Paragraph(f_text, style["Normal"])
+                    data.append([f_label,f_text])
+            table = Table(data,style=SLIP_STYLE, colWidths=[5*cm, 13.5*cm])
+            story.append(table)
+
         try:
             frame_body.addFromList(story,pdf)
@@ -269,15 +295,22 @@
             view.flash('Error in image file.')
             return view.redirect(view.url(view.context))
-        insert_footer(pdf,width,style,footer_text)
-        pdf.showPage()
-        frame_body = Frame(1*cm,1*cm,width-(2*cm),height-(1.5*cm))
-        # Insert content table
+
         if tabledata and tableheader:
+            insert_footer(pdf,width,style,footer_text,number_of_pages=2)
+        else:
+            insert_footer(pdf,width,style,footer_text)
+
+        # Insert content table on second page
+        if tabledata and tableheader:
+            pdf.showPage()
+            frame_body = Frame(1*cm,1*cm,width-(2*cm),height-(2*cm))
             story = []
+            story.append(Paragraph(view.content_title, style["Heading3"]))
             #story.append(Spacer(1, 12))
             contenttable = render_table_data(tableheader,tabledata)
             story.append(contenttable)
             frame_body.addFromList(story,pdf)
-        insert_footer(pdf,width,style,footer_text)
+            insert_footer(pdf,width,style,footer_text,number_of_pages=2)
+
         view.response.setHeader(
             'Content-Type', 'application/pdf')
