<?php
/* $headerhtml & $footerhtml will be repeated on each page */
/* ********************************************************* */
$headerhtml = '<html><head></head><body><table width="100%" border="0"><tr><td width="100%"><img src="' . $_SERVER['HTTP_HOST'] . '/logo.png" /><span style="float:right;font-size:12px">Some Text</span></td></tr></table></body></html>';
$footerhtml = '<html><head></head><body><table width="100%" border="0"><tr><td width="100%" style="text-align:center;font-size:10px;color:blue;">1 Anystreet, Anytown, Anycounty tel: 01234 567890 mail@address.co.uk</td></tr></table></body></html>';
$wkhtmloptions['global'] = array( 'colorMode' => 'grayscale', 'margin.top' => '15mm' );
$wkhtmloptions['object'] = array( 'header.spacing' => '5mm', 'footer.spacing' => '2mm' );
$pdf = new wkhtmltopdf(array(
'title' => 'Title',
'html' => 'Content',
'tmppath' => $_SERVER['DOCUMENT_ROOT'].'tmp',
'header_html' => $headerhtml,
'footer_html' => $footerhtml,
'options' => $wkhtmloptions,
) ,'php');
$pdf->output('I', 'document.pdf');
?>
|