Ignore:
Timestamp:
7 Apr 2012, 08:15:16 (12 years ago)
Author:
uli
Message:

Improve pdf generation: a global pdf generator, watermarks and more.

File:
1 edited

Legend:

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

    r7819 r8059  
    163163        """Get captcha chosen for a certain site or default.
    164164        """
     165
     166class IPDFCreator(Interface):
     167    """A component that knows where logo graphics for PDFs are stored
     168    and can generate PDF documents.
     169
     170    It is a utility (and not a simple function or class) to make these
     171    data customizable in derived packages.
     172    """
     173    header_logo_path = schema.TextLine(
     174        title = u'Path to header logo JPG')
     175    watermark_path = schema.TextLine(
     176        title = u'Path to watermark logo JPG')
     177    def paint_background(canvas, doc):
     178        """A callback function to render background of PDFs.
     179        """
     180    def create_pdf(data, headerline=None, title=None):
     181        """Create a PDF.
     182
     183        `data` is expected to be a list of reportlab flowables
     184        (paragraphs, images, tables, etc.), that will be rendered into
     185        some background.
     186
     187        `headerline` will be displayed in page head and `title` under
     188        the top bar.
     189
     190        If no `headerline` is given, a default will be rendered (name
     191        of university).
     192
     193        If no `title` is given, nothing will be rendered.
     194        """
Note: See TracChangeset for help on using the changeset viewer.