arilia
arilia

Reputation: 9398

How can I set different bottom margin for first and following pages?

I have a mpdf object in which I write some HTML code

$mpdf->AddPage('P', '', '', '', '', 20, 20, 25, 30, 15, 5);
$mpdf->WriteHTML($html);

I don't know how many pages will result. $html could contain a lot of text or just a couple of lines;

But the bottom margin should be set to a different value starting from the second page because I have a big footer only in the first page but not in the following.

I already tried playing around with setAutoBottomMargin but with no success

Is there a way to obtain this using mPfd?

Upvotes: 0

Views: 696

Answers (1)

arilia
arilia

Reputation: 9398

I found a solution using @page as described here

Since @page support pseudo selectors (here) I was able to do

@page :first{
    margin-bottom: 30mm;
    margin-top: 60mm; 
}

@page {
    margin-bottom: 25mm;
    margin-top: 25mm; 
}

this set different margins for the first and the following pages

Upvotes: 1

Related Questions