Skip to content

Commit

Permalink
template: fixed page number (restart when load new elements)
Browse files Browse the repository at this point in the history
  • Loading branch information
reingart committed Nov 24, 2013
1 parent d8336a2 commit 8f8e719
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fpdf/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def __init__(self, infile=None, elements=None, format='A4', orientation='portrai
self.load_elements(elements)
self.handlers = {'T': self.text, 'L': self.line, 'I': self.image,
'B': self.rect, 'BC': self.barcode, }
self.pg_no = 0
self.texts = {}
pdf = self.pdf = FPDF(format=format,orientation=orientation, unit="mm")
pdf.set_title(title)
Expand All @@ -30,6 +29,7 @@ def __init__(self, infile=None, elements=None, format='A4', orientation='portrai

def load_elements(self, elements):
"Initialize the internal element structures"
self.pg_no = 0
self.elements = elements
self.keys = [v['name'].lower() for v in self.elements]

Expand All @@ -39,6 +39,7 @@ def parse_csv(self, infile, delimiter=",", decimal_sep="."):
'bold','italic','underline','foreground','background',
'align','text','priority', 'multiline')
self.elements = []
self.pg_no = 0
for row in csv.reader(open(infile, 'rb'), delimiter=delimiter):
kargs = {}
for i,v in enumerate(row):
Expand Down

0 comments on commit 8f8e719

Please sign in to comment.