Hello. This is related to
disable header/footer on first page, but though there seems to be a patch on that discussion, it doesn't appear to have been merged.
My html page works mostly fine, but I need the header disabled on the first page, since I already include it in the body of my document. Not simply making it invisible, but to remove it and reclaim the space taken up by the header (including the '--header-spacing 5' that I run wkhtmltopdf with to account for
overlapping content).
If I set the headers' style to 'display:none;', the PDF comes out blank.
Here's my header:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type='text/css'>
h1, h2, h3, h4, h5, h6 {text-align: center;white-space:pre;}
h3 {font-size: 14px;}
h4 {font-size: 12px;}
</style>
<script type="text/javascript">
function foo() {
var pdfInfo = {},
x = window.location.search.substring(1).split('&');
for (var i in x) { var z = x[i].split('=',2); pdfInfo[z[0]] = unescape(z[1]); }
var body = document.getElementById('pageHeader');
var replacements = ['section', 'subsection'];
for (var y=0; y < replacements.length; y++) {
if (pdfInfo.sitepage == 1) {
var children = body.getChildren();
for (var k=0; k < children.length; k++) {
body.removeChild(children[k]);
}
} else {
var el = document.getElementsByClassName(replacements[y])[0];
el.textContent = pdfInfo[replacements[y]];
}
}
}
</script>
</head>
<body id='pageHeader' onload="foo();" style='margin:0; padding:0;'>
<h3 class="section"> </h3>
<h4 class="subsection"></h4>
</body>
</html>