Reputation: 127
@page :last {
background: rgb(167,0,51);
}
I need to add background for last page of my PDF but it not working. Only first page is getting bg but not last. Is there any solution?
Reference Link is given below. MPDF - different background for first page
Upvotes: 3
Views: 1662
Reputation: 1498
There is no option to add specific CSS for the Last page of PDF in MPDF till now.
But MDF provides options to add CSS to a specific page using "@page <named>
".
(https://mpdf.github.io/css-stylesheets/supported-css.html)
If you are using AddPage()
to create pages, you can just add a page selector(Example: "lastpage
") to that specific page and add CSS like below.
@page lastpage{background: rgb(167,0,51);}
If you are using <pagebreak>
to create pages, you can add page selector (Example: <pagebreak page-selector="lastpage">
) to that <pagebreak>
tag and add CSS like below.
@page lastpage{background: rgb(167,0,51);}
This will definitely work. I have tried and tested.
Upvotes: 4