mPDF Manual – HTML control tags

# watermarktext

(mPDF >= 3.0)

watermarktext – Set the text to use as a Watermark

## Description

<watermarktext  $content [$alpha ] />

Set the text to use as a Watermark. The watermark is a semi-transparent background printed on each page, used for text such as “DRAFT”. The watermark will be added to each page when the Footer is printed if the variable showWatermark is set to 1 or true

## Parameters

$content This parameter defines the text to use for the watermark.$content cannot contain any of the characters: <, >, &, ' or " and must use the appropriate HTML entities e.g. <watermarktext content="Brian&amp;#039;s document" />  It is recommended that you use htmlspecialchars('Content', ENT_QUOTES) for this.

If the text is blank, it will clear the watermark text, so nothing appears.

Default: BLANK

$alpha This parameter defines the transparency value (alpha) to use for the watermark: either text or image. The Value should be between '0' and '1'. Default: '0.2' ## Changelog Version Description 3.0 The tag was added. ## Examples Example #1 <?php$mpdf = new \Mpdf\Mpdf();

$mpdf->showWatermarkText = true;$mpdf->WriteHTML('<watermarktext content="DRAFT" alpha="0.4" />');

\$mpdf->WriteHTML('
Hello World
');