<apex:page renderAs="pdf" Controller="testpdf1">
<head>
<style type="text/css" media="print">
@page {
{
size: 8.5in 11in;/* width height */
}
@page {
{
@top-center {
{
content: element(header);
}
@bottom-left {
{
content: element(footer);
}
}
div.header {
{
padding: 10px;
position: running(header);
}
div.footer {
{
display: block;
padding: 5px;
position: running(footer);
}
.pagenumber:before {
{
content: counter(page);
}
.pagecount:before {
{
content: counter(pages);
}
</style>
</head>
<div class="header">
<div align="right">Header</div>
</div>
<div class="footer">
<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
</div>
<div class="content">
<p>
<p><apex<apex:repeat value="{!opp}" var="item">
<tr>
<td class="tableContent">{!item.Name}</td>
</tr>
</apex:repeat></p>
repeat>
</div>p>
</div>
</apex:page>
controllerController
public class testpdf1
{
public list<Account> opp{get;set;}
public testpdf1()
{
opp=[SELECT Name from Account limit 50];
}
}