useLang
(mPDF ≥ 2.3 && ≤ 5.7)
useLang – Specify whether to recognise/support the HTML attribute lang
Description
void useLang
Specify whether to recognise/support the HTML attribute lang.
See lang for more details.
Note: This variable was removed in mPDF 6.0 autoScriptToLang should be used for the same effect.
Note: The default value was changed to true
in version 4.0
Note: lang=
is a useful way to select appropriate fonts for some
languages.
Automatic font selection using SetAutoFont() marks up the HTML with the lang attribute, so useLang is required. Using automatic font selection adds considerable processing time when creating a large document. Automatic font selection is only valid when using UTF-8 as the codepage for the document.
Values
$useLang =true
|false
Values
true
: recognise/support the HTML attribute lang.false
: does not recognise/support the HTML attribute lang.
Default: true
Changelog
Version | Description |
---|---|
2.3 | Variable was added. |
4.0 | Default value changed to true |
Examples
Example #1
<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf('utf-8');
$html = '
Start with some English text
هل ستسفر الجهود الدبلوماسية الجارية عن حلول؟ وكيف تنظر للاتهامات لبعض هذه الدول بالتدخل في الشأن العراقي، والتورط في دعم عمليات العنف؟ والى اي مدى يبدو الوضع في العراق انعكاسا للصراعات الإقليمية في المنطقة؟
And again in English
';
$mpdf->useLang = true;
$mpdf->WriteHTML($html);
$mpdf->Output();
See Also
- SetAutoFont() - Use AutoFont to auto-detect text language in HTML input
- autoFontGroupSize - Specify the text chunk size to group when autodetecting text language
- disableMultilingualJustify (mPDF < 6.0) - Specify whether to disable text justification in multilingual documents
- lang - Information on mPDF support for the HTML attribute lang