I am using Dompdf to convert html to pdf.
Here's the code:
require_once 'dompdf/autoload.inc.php';
$tmp = sys_get_temp_dir();
$dompdf = new Dompdf([
'logOutputFile' => '',
// authorize DomPdf to download fonts and other Internet assets
'isRemoteEnabled' => true,
// all directories must exist and not end with /
'fontDir' => $tmp,
'fontCache' => $tmp,
'tempDir' => $tmp,
'chroot' => $tmp,
]);
$html = // Html code here
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$dompdf->stream("fitphase",array("Attachment"=>0));
I have used the following font:
<style>
* {
font-family: DejaVu Sans, sans-serif;
}
</style>
Now, issue is that the text displayed in arabic is showing from left to right and I want the direction to be from right to left.
I have found this link https://github.com/learn05/arabiclang/ for Laravel but need the solution with php.