Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

Header in PDF page using DOMPDF in PHP

<!-- See PDF debugger: https://eclecticgeek.com/dompdf/debug.php?identifier=b7d40757e13c269fc088be303b5ff099 -->
<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>Widgets Express</h1>
  </div>
  <div id="footer">
    <p class="page">Page </p>
  </div>
  <div id="content">
    <p>the first page</p>
    <p style="page-break-before: always;">the second page</p>
  </div>
</body>
</html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Header #PDF #page #DOMPDF #PHP
ADD COMMENT
Topic
Name
4+4 =