phpwkhtmltopdf: Footer and Header not working

When I try to add a footer using this code nothing shows up.

$footer = "<html><div style='height:2.54cm;width:100%;background:#cccccc;'>Hello how are you<br/>hhhh<br/>hhhh</div></html>";
$pdf->addPage($top.$specHtml.$modelHtml.$picHtml, array('footer-html' => $footer));

Everything else is generated fine. When I use the same code but with header-html it show a small white space at the top of my pages but no other content is inserted.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

If testing with --header-html option, make sure you include the following as part of your string:

<!DOCTYPE html>

Once I added that, it works flawless in both wkhtmltopdf in command line or using phpwkhtmltopdf

Sure, try: echo (string) $pdf->getCommand() or more literal $pdf->getCommand()->getExecCommand()