Ignore:
Timestamp:
23 Apr 2012, 11:56:06 (13 years ago)
Author:
uli
Message:

Support notes in generated PDFs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py

    r8234 r8257  
    7171    )
    7272
     73#: A reportlab paragraph style for notes output at end of documents.
     74NOTE_STYLE = ParagraphStyle(
     75    name='Note',
     76    parent=NORMAL_STYLE,
     77    fontName='Helvetica',
     78    fontSize=12,
     79    )
     80
    7381def format_html(html):
    7482    """Make HTML code usable for use in reportlab paragraphs.
     
    349357
    350358    def create_pdf(self, data, headerline=None, title=None, author=None,
    351                    footer=''):
     359                   footer='', note=None):
    352360        """Returns a binary data stream which is a PDF document.
    353361        """
     
    367375        doc.kofa_author = author
    368376        doc.kofa_footer = footer
     377        if note is not None:
     378            html = format_html(note)
     379            data.append(Paragraph(html, NOTE_STYLE))
    369380        doc.build(data, onFirstPage=self.paint_background,
    370381                  onLaterPages=self.paint_background,
Note: See TracChangeset for help on using the changeset viewer.