Is there a way to set margins to be different for DOMPDF on a per page basis (at least just the first page)
02:30 19 Jul 2024

I was hoping to create a coverpage for my pdf but I can't figure it out.

I have DOMPDF successfully creating my pdf. I wanted a coverpage that is full bleed, no footer (I used the Canvas to create a footer with page count).

I was able to get the footer to be removed, but I can't figure out the margins.

In my css which is an external file, I can set

@page { 
    margin:0;
}

This makes the coverpage look great but it also removes margins from all the other pages. Which is not what I really want to happen. Is there a way to specify only the first page?

Looking through some other questions I noticed that you could call the current page via css. As an example:

.footer .page-number:after { 
    content: counter(page);
}

But I couldn't get any action based on using counter(page) as a selector.

I looked into rendering 2 $html sets together to make 1 pdf but the DOMPDF notes say that's not possible and could cause some rendering errors.

I'm using DOM 3.0.0 CPDF in a WordPress installation.

php dompdf