Changeset 6357


Ignore:
Timestamp:
12 Jun 2011, 07:04:07 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement pdf slip demo version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r6355 r6357  
    3131
    3232from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     33
     34from reportlab.pdfgen import canvas
    3335
    3436from waeup.sirp.browser import (
     
    572574        return
    573575
     576class PDFActionButton(ManageActionButton):
     577    grok.context(IApplicant)
     578    grok.view(DisplayApplicant)
     579    grok.require('waeup.handleApplication')
     580    icon = 'actionicon_pdf.png'
     581    text = 'Download pdf slip'
     582    target = 'application_slip.pdf'
     583
     584class ExportPDFPage(grok.View):
     585    """Deliver a PDF slip of the context.
     586    """
     587    grok.context(IApplicant)
     588    grok.name('application_slip.pdf')
     589    grok.require('waeup.handleApplication')
     590
     591    # Render a demo pdf pagge
     592    def render(self):
     593        #exporter = IWAeUPXMLExporter(self.context)
     594        #xml = exporter.export().read()
     595        pdf = canvas.Canvas("application_slip.pdf")
     596        pdf.drawString(100,750,"Welcome to Reportlab!")
     597        self.response.setHeader(
     598            'Content-Type', 'application/pdf')
     599        return pdf.getpdfdata()
     600
    574601class EditApplicantStudent(EditApplicantFull):
    575602    """An applicant-centered edit view for applicant data.
Note: See TracChangeset for help on using the changeset viewer.