<apex:page applyHtmlTag="false"
showHeader="false"
renderAs="pdf">
<html>
<head>
<style>
@page {
size: A4;
margin-top: 2cm;
margin-bottom: 2cm;
margin-left: 3cm;
margin-right: 3cm;
@top-center {
content: element(header);
}
@bottom-left {
content: element(footer);
}
}
div.header {
position: running(header);
}
div.footer {
display: block;
position: running(footer);
}
.pagenumber:before {
content: counter(page);
}
.pagecount:before {
content: counter(pages);
}
</style>
</head>
<body>
<div class="header">
<div>This is the header</div>
<hr />
</div>
<div class="footer">
<hr />
<div>This the footer with page number</div>
<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
</div>
<div class="content">
<p>Actual page body information.</p>
</div>
</body>
</html>
</apex:page>
Last active
July 24, 2024 04:01
-
-
Save kevanmoothien/300da55b5dbce2d7d7e2bf8662c7fefd to your computer and use it in GitHub Desktop.
A visualforce template with header and footer for pdf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment