Search code examples
phppage-break

How do I Detect page breaks with PHP


Is there a way to detect page breaks with php? I generate a report with PHP and I use page breaks for different paragraphes. I need to keep a header in every page. Is there a way to do it?


Solution

  • HTML (only using CSS):

    <hr style="page-break-after:always; visibility: hidden">

    PDF:

    use the HTML above and use wkhtmltopdf to convert to PDF. Other converters might work, yet this one is the best.

    TEXT/CONSOLE(CLI):

    chr(0xC), aka "\f".