Some quick javascript can take care of this. Follow the boilerplate laid out under 'Footers And Headers' on wkhtmltopdf
These are your header and footer templates respectively.
The key variable to keep track of is 'page' which is available from URL hash.
Your header will look something like this:
<div class="headerContent" style="display:none">
...my awesome html
<hr />
</div>
<script type="text/javascript">
var headerCheck = function() {
var x=document.location.search.substring(1).split('&');
for (var i in x) {
if(x[i] == "page=1")
document.getElementsByClassName("headerContent")[0].style.display = "block";
}
}();
</script>
Similarly for your footer the code will look something like this:
<div class="footerContent" style="display: none">
...awesome footer html
</div>
<script type="text/javascript">
var footerCheck = function() {
var x=document.location.search.substring(1).split('&');
var currentPage = 1;
for (var i in x) {
var z=x[i].split('=',2);
if(z[0] == "page")
currentPage = unescape(z[1]);
if(z[0] == "topage" && currentPage == unescape(z[1]))
document.getElementsByClassName("footerContent")[0].style.display = "block";
}
}();
</script>
render :partial => '/path/to/my/header'
on the first page? – Zobkiw