# HG changeset patch # User Tero Marttila # Date 1293745500 -7200 # Node ID 26ae1b1db3c74bca3184472425c10eeadd5a98a6 # Parent c68ca09b08b9be203ba33481d081e5b363c38fd3 pdf: add SignatureBlock(fullheight=) param diff -r c68ca09b08b9 -r 26ae1b1db3c7 svv/pdf.py --- a/svv/pdf.py Thu Dec 30 23:44:10 2010 +0200 +++ b/svv/pdf.py Thu Dec 30 23:45:00 2010 +0200 @@ -180,11 +180,12 @@ # empty space to leave below the fields PADDING_BOTTOM = inch / 2 - def __init__ (self, cols, fields, values) : + def __init__ (self, cols, fields, values={}, fullheight=None) : """ - cols - Column titles - fields - Fields titles, describing the horizontal fields - values - Pre-filled values as a {(col, field): value} dict + cols - Column titles + fields - Fields titles, describing the horizontal fields + values - Pre-filled values as a {(col, field): value} dict + fullheight - Consume full vertical height to place at bottom of page desc/value strings can contain formatting codes: @@ -195,6 +196,7 @@ self.cols = cols self.fields = fields self.values = values + self.fullheight = fullheight def wrap (self, width, height) : """ @@ -203,8 +205,11 @@ self.width = width - # consume all available height, to place us at the bottom - self.height = max(len(self.fields) * self.FIELD_HEIGHT, height) + self.height = len(self.fields) * self.FIELD_HEIGHT + + if self.fullheight : + # consume all available height, to place us at the bottom + self.height = max(self.height, height) return self.width, self.height