Y
Y
Yuriy2018-07-17 17:47:06
PHP
Yuriy, 2018-07-17 17:47:06

Dompdf Cyrillic is all about why?

there are no problems on the local, everything is fine... I upload all the Cyrillic in the questions to the hosting...
on the local OSPanel, apache, php 7.1 configuration settings for BITRIX
on the apache + nginx server, php7.0 settings for BITRIX I
specify UTF-8 everywhere and in the html itself and the page itself is formed in utf-8

<?
header('Content-type: text/html; charset=UTF-8') ;
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
?>
<?

require_once ($_SERVER['DOCUMENT_ROOT'].'/local/modules/dompdf/autoload.inc.php');
use Dompdf\Dompdf;

ob_start();

?>
<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	
<style type="text/css">
* { 
  font-family: 'DejaVu Sans' !important;
}
</style>
</head>
<body>
<h1>Привет мир!</h1>
<div>Это pdf</div>
</body>
</html>
<?


$html = ob_get_clean();
//$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
?>
<?
$dompdf = new Dompdf();
 
//дефолтный шрифт - dejavu sans, т.к. он поддерживает кириллицу
$dompdf->set_option('fontDir', __DIR__.'/local/modules/dompdf/lib/fonts');
$dompdf->set_option('defaultFont', 'dejavu sans');
//даём возможность читать внешние ссылки (для отображения картинок извне)
$dompdf->set_option('isRemoteEnabled', true);
//запихиваем html-ку в преобразователь
$dompdf->loadHtml($html, 'UTF-8');
//ставим A4 вертикально
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF - рендерим
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream($arSection['ID'].'_'.$arSection['CODE'].'.pdf',array('Attachment'=>0));

5b4dffc9ea05f239196748.jpeg
it seems that the fonts are simply not loaded on the server, the paths to the fonts are indicated everywhere.
tell me what the heck...?...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Mosyukov, 2018-07-17
@GeneMoss

The font does not support Unicode or Cyrillic. Download another font with guaranteed Unicode and Cyrillic support.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question