mPDF Manual – mPDF Variables

allow_html_optional_endtags

(mPDF >= 1.0)

Description

boolean allow_html_optional_endtags

When true, mPDF will attempt to parse the input HTML allowing for omitted end-tags. Some end tags are optional in HTML 4 (see http://www.w3.org/TR/1998/REC-html40-19980424/index/elements.html ). These include (not exclusively): P, LI, DD, DT, TR, TD

Values

$allow_html_optional_endtags = true|false

Values

  • true: (Default) Parse the input HTML allowing for omitted end-tags
  • false: Expect well formed (X)HTML with closing tags on all elements.

Usage

Set at beginning of document

<?php
$mpdf = new \Mpdf\Mpdf(['allow_html_optional_endtags' => true]);

Examples

<?php
require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf(['allow_html_optional_endtags' => true]);

$mpdf->WriteHTML('<p>Hello World');
$mpdf->WriteHTML('<p>Hello World');
$mpdf->WriteHTML('<p>Hello World');

$mpdf->Output();

Fork me on GitHub