Hi all,
I'm having trouble positioning and repeating the header and footer using the example code.
My HTML validates XHTML Transitional, and I believe I've followed the example exactly.
This is what it looks like in HTML, note that the header and footer appear correctly fixed at the top and bottom of the "page"
This is the PDF view,
The code to export it couldn't be simpler:
<?php
require_once("components/com_quote/assets/pdf/dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
ob_start();
?>
<head>
<link rel="stylesheet" href="components/com_quote/assets/css/pdf.css" type="text/css" />
</head>
<body>
<div id="header">
<table>
<tr>
<td>Example document</td>
<td style="text-align: right;">Author</td>
</tr>
</table>
</div>
<div id="footer">
<table>
<tr>
<td>Example footer</td>
<td style="text-align: right;">Author</td>
</tr>
</table>
<div class="page-number"></div>
</div>
SNIP...full html of the export...SNIP
</div>
</body>
</html>
<?php
$html = ob_get_contents();
ob_end_clean();
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream($params->get('filename','Kiosk_Quote_') . $q_id . ".pdf",array("Attachment" => 0));
?>
The included CSS file uses the example code:
/*****************Start of PDF Header**********************/
@page {
margin: 2cm;
}
body {
margin: 0.5cm 0;
text-align: justify;
}
#header,
#footer {
position: fixed;
left: 0;
right: 0;
color: #aaa;
font-size: 0.9em;
height:100px;
}
#header {
top: 0;
border-bottom: 0.1pt solid #aaa;
}
#footer {
bottom: 0;
border-top: 0.1pt solid #aaa;
}
#header table,
#footer table {
width: 100%;
border-collapse: collapse;
border: none;
}
#header td,
#footer td {
padding: 0;
width: 50%;
}
.page-number {
text-align: center;
}
.page-number:before {
content: "Page " counter(page);
}
hr {
page-break-after: always;
border: 0;
}
Any ideas?
Thanks!