mPDF Manual – mPDF functions

SetDefaultBodyCSS()

(mPDF ≥ 4.2)

SetDefaultBodyCSS – Change default CSS properties at runtime

Description

void SetDefaultBodyCSS ( string $property , string $value )

Change default CSS properties at runtime. This changes the default CSS stylesheet values for the BODY element.

Parameters

$property

Specifies the CSS property to set. Any valid CSS property that mPDF supports for the BODY element e.g.

font-family, font-size, color

Case-insensitive

$value

Specifies the value for the given property.

Examples

<?php
$mpdf = new \Mpdf\Mpdf();

$mpdf->SetDefaultBodyCSS('color', '#880000');

$mpdf->WriteHTML('Hallo World should be in red');
$mpdf->Output();

Fork me on GitHub