I have done it this way (code abstract not tested):
### model
db.define_table('t_persons',
Field('f_surname', type='string', notnull=True, label=T('Surname'),
length=32),
Field('f_name', type='string', notnull=True, label=T('Name'), length=32),
)
### controller
def myreport():
persons = db(db.t_persons.id > 0).select()
logourl = URL('static','images/mylogo.jpg',host=True)
html = response.render('resources/myreport.html', dict(persons = persons,
tdy=date.today(), logo=logourl))
return plugin_appreport.REPORTPISA(html = html)
### view myreport.html
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
@page {
margin: 1cm;
margin-bottom:2.5cm;
@frame footer {
-pdf-frame-content: footerContent;
/*-pdf-frame-border: 1;*/
bottom: 0cm;
margin-left: 1cm;
margin-right: 1cm;
height: 1cm;
}
}
h2 {font-width:bold;text-align:center;}
tr td{}
.section{border:1px solid #000;font-weight:bold;padding:4px 6px 0;}
.label{width:45%;}
.data{width:54%;}
</style>
</head>
<body>
<img src="{{=logo}}" alt="company logo" width="93" height="69"/>
<h2>Titolo</h2>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<thead>
<tr>
<td class="label"> </td>
<td class="data"> </td>
<td> </td>
</tr>
</thead>
<tbody>
{{for p in persons:}}
<tr>
<td colspan='3'> </td>
</tr>
<tr>
<td class="section" colspan="2">SECTION TITLE</td>
<td> </td>
</tr>
<tr>
<td colspan='3'> </td>
</tr>
<tr>
<td><strong>Surname</strong></td>
<td>{{=p.f_surname}}</td>
<td> </td>
</tr>
<tr>
<td><strong>Given Name</strong></td>
<td>{{=p.f_name}}</td>
<td> </td>
</tr>
{{pass}}
</tbody>
</table>
<div id="footerContent">
page #<pdf:pagenumber> printed on {{=tdy}}
</div>
</body>
### in view print_report.html
{{=A(SPAN(T('print report'), _class='printer_ico'), _href=URL('myreport'),
_class="button")}}
Let me know if this works.
Ciao,
Paolo