jeudi 3 septembre 2020

Can't make static header or footer with Laravel-DOMPDF

I'm using laravel-dompdf to create pdfs within my Laravel app, but I can't seem to get the static headers and footers to work. I'm using Laravel 5.8 and "barryvdh/laravel-dompdf": "^0.8.4", and I've tried the suggestions found below:

What I've tried

Even if I literally copy and paste the following (borrowed from here) into my html content, the package will create a pdf with two pages (as expected), but there is no header and the footer just appears once after the last of the content, not at the bottom of each page as expected.

<html>
<head>
  <style>
    @page { margin: 100px 25px; }
    header { position: fixed; top: -60px; left: 0px; right: 0px; background-color: lightblue; height: 50px; }
    footer { position: fixed; bottom: -60px; left: 0px; right: 0px; background-color: lightblue; height: 50px; }
    p { page-break-after: always; }
    p:last-child { page-break-after: never; }
  </style>
</head>
<body>
  <header>header on each page</header>
  <footer>footer on each page</footer>
  <main>
    <p>page1</p>
    <p>page2></p>
  </main>
</body>
</html>

Am I missing something obvious? Any suggestions? Thanks in advance!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3blh9i1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire