Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mPDF doesn't print Hebrew on the pdf file

Tags:

php

mpdf

I have this problem using mPDF with hebrew language.

These are mPDF and PHP versions I am using PHP: 5.6.25 mPDF: up to date

This is a PHP code snippet I use

<?php

require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new mPDF('utf-8');
$mpdf->SetDirectionality('rtl');
$mpdf->WriteHTML('<h1 lang="he">sssשדגשדגשדג</h1>');
$mpdf->Output();

as you can see, I have added utf8 charset and set direction to rtl.

when I exec the code I get only the sss letters without the hebrew I think its ignore them.

THANKS~

like image 804
Itzik.B Avatar asked Sep 02 '25 04:09

Itzik.B


1 Answers

Just put this in your code before $mpdf->WriteHTML();

$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
like image 109
Jayvirsinh Vaghela Avatar answered Sep 05 '25 00:09

Jayvirsinh Vaghela