example17_headers_method_3.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. $html = '
  3. <!-- defines the headers/footers - this must occur before the headers/footers are set -->
  4. <!--mpdf
  5. <pageheader name="odds" content-right="My document" header-style-right="color: #880000; font-style: italic;" line="1" />
  6. <pageheader name="evens" content-right="{DATE j-m-Y}" content-center="{PAGENO}/{nb}" header-style="color: #880000; font-style: italic;" />
  7. <pagefooter name="odds" content-right="Odd Footer" footer-style-right="color: #880000; font-style: italic;" line="1" />
  8. <pagefooter name="evens" content-right="{DATE j-m-Y}" content-center="{PAGENO}/{nb}" footer-style="color: #880000; font-style: italic;" />
  9. <pageheader name="display" content-center="New header called Display" header-style="color: #000088; font-weight: bold;" />
  10. mpdf-->
  11. <!-- set the headers/footers - they will occur from here on in the document -->
  12. <!--mpdf
  13. <setpageheader name="odds" page="odd" value="on" show-this-page="1" />
  14. <setpageheader name="evens" page="even" value="1" />
  15. <setpagefooter name="odds" page="O" value="on" />
  16. <setpagefooter name="evens" page="E" value="1" />
  17. mpdf-->
  18. <h1>mPDF</h1>
  19. <h2>Headers & Footers Method 3</h2>
  20. <p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
  21. <pagebreak />
  22. <h2>Headers & Footers Method 3</h2>
  23. <p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
  24. <pagebreak odd-header-name="display" odd-header-value="1" even-header-name="display" even-header-value="1" />
  25. <h2>Headers & Footers</h2>
  26. <p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p>
  27. ';
  28. //==============================================================
  29. //==============================================================
  30. //==============================================================
  31. include("../mpdf.php");
  32. $mpdf=new mPDF('en-GB-x','A4','','',32,25,27,25,16,13);
  33. $mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins
  34. $mpdf->WriteHTML($html);
  35. $mpdf->Output();
  36. exit;
  37. //==============================================================
  38. //==============================================================
  39. //==============================================================
  40. ?>