Dompdf used to generate PDF but there is occurred a problem to attach header and footer on every page . Following is a solution to attach header and footer on every page.
copy whole code.
This code have all setting is correctly done.
just you need include library of dompdf.
require_once("dompdf/dompdf_config.inc.php");
$html = '
<html>
<head>
<style>
@page { margin: 180px 50px; }
#header { position: fixed; left: 0px; top: -180px; right: 0px; height: 150px; background-color: orange; text-align: center; }
#footer { position: fixed; left: 0px; bottom: -180px; right: 0px; height: 150px; background-color: lightblue; }
#footer .page:after { content: counter(page, upper-roman); }
</style>
<body>
<div id="header">
<h1>ibmphp.blogspot.com</h1>
</div>
<div id="footer">
<p class="page"><a href="ibmphp.blogspot.com"></a></p>
</div>
<div id="content">
<p><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
</div>
</body>
</html>
';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("paulsmith.pdf");
This will definately help you.
copy whole code.
This code have all setting is correctly done.
just you need include library of dompdf.
require_once("dompdf/dompdf_config.inc.php");
$html = '
<html>
<head>
<style>
@page { margin: 180px 50px; }
#header { position: fixed; left: 0px; top: -180px; right: 0px; height: 150px; background-color: orange; text-align: center; }
#footer { position: fixed; left: 0px; bottom: -180px; right: 0px; height: 150px; background-color: lightblue; }
#footer .page:after { content: counter(page, upper-roman); }
</style>
<body>
<div id="header">
<h1>ibmphp.blogspot.com</h1>
</div>
<div id="footer">
<p class="page"><a href="ibmphp.blogspot.com"></a></p>
</div>
<div id="content">
<p><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
<p style="page-break-before: always;"><a href="ibmphp.blogspot.com">ibmphp.blogspot.com</a></p>
</div>
</body>
</html>
';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("paulsmith.pdf");
This will definately help you.
gracias, lo estaba buscando :)
ReplyDeleteGreat
ReplyDeleteVery cool! (but hey it's missing the closing head tag)
ReplyDeleteIt got me #$%#$&@#^^ but now I'm \o/.. Thank you for this.
ReplyDeletethx a lot! this was rly helpfull
ReplyDeleteReally Saved my day and a lot of time! Bless you. Thanks!
ReplyDeleteAwesome, thank you!
ReplyDeletethank u!!!
ReplyDeleteHey its a greate code .. but i have a mistake well like a mistake there is a blank space after the header and i want to detele it, because of this mi content has a bad distribution
ReplyDeleteThanks!!!! :)
ReplyDeleteGood job.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks works for me.. :)
ReplyDeleteHi thank you very much, it works like a charm. :)
ReplyDeleteBest tutorial I have found, woks perfectly
ReplyDeleteThis post is very informative for understanding the DOMPDF. Thank you so much for sharing this post.
ReplyDeleteI really like it.
PHP training in Nagpur
Resolveu meu problema, nem o criador do DOMPDF tinha a solução para o Rodapé que não aparece em todas as páginas. Obrigado.
ReplyDelete