mPDF Manual – mPDF Variables

# setAutoTopMargin

(mPDF ≥ 4.0)

## Description

mixed setAutoTopMargin

Specify the behaviour defining the top-margin of the document. When setAutoTopMargin is set to 'stretch' then autoMarginPadding defines the minimum distance in mm that will be forced between the bottom of the header and the top of the main text.

## Values

setAutoTopMargin

Values

'pad'
The value for margin-top is used to set a fixed distance in mm (padding) between the bottom of the header and top of the main text
'stretch'
margin-top sets a minimum distance in mm between the top of the page and the top of the main text, which expands if header is too large to fit.
false
the defined value for margin-top is respected even if the header overlaps the main body of the document.

Default: false

## Examples

<?php

\$mpdf = new \Mpdf\Mpdf(['setAutoTopMargin' => 'pad']);