Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lilo's avatar
Level 2

How to remove header and footer from last page of pdf

Hello,

I generate a pdf using laravel dompdf and I have cover and end page.

I was able to remove the header and footer on the cover page, but I could not remove those on the end page.

How can I do it?

0 likes
3 replies
redroseamit's avatar

remove this one ..

<div id="footer">
                    <img src="./pdf-footer.jpg" width="700px" height="100px">                 
                  </div>

 <div id="header">
                    <img src="./pdf-header.jpg" width="700px" height="100px">
                  </div>

lilo's avatar
Level 2

But when I remove these two, it disappears from all the pages. I want to remove from only the last page. @redroseamit

redroseamit's avatar

you can add partial header and footer seprately in every page by using this code. @include(foldername/header); and add this code line in every page where your header lines located.

 @include(foldername/header);

in every page where these lines located


<div id="header">
                    <img src="./pdf-header.jpg" width="700px" height="100px">
                  </div>

similarly you can do for footer

Please or to participate in this conversation.