mPDF Manual – mPDF functions

SetDirectionality()

(mPDF ≥ 1.0)

SetDirectionality – Set the document RTL state

Description

void SetDirectionality ( string $dir )

Set the document RTL state. This defines the default alignment of tables, columns, text justification, page layout etc. See RTL & Bidirectional Text for more details. If SetDirectionality('rtl') is set, Text Bidirectionality is automatically turned on.

Parameters

$dir

Defines the directionality of the document

BLANK or omitted (or any value other than 'rtl' or 'RTL') sets the default of 'ltr'

Values (case-insensitive)

  • 'ltr'
  • 'rtl'

Default: 'ltr'

Examples

<?php
$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8']);

$mpdf->SetDirectionality('rtl');

$mpdf->WriteHTML('דג סקרן שט בים מאוכזב ולפתע מצא חברה');
$mpdf->Output();

Fork me on GitHub