F
F
fgjcirifb2019-03-02 13:46:11
PHP
fgjcirifb, 2019-03-02 13:46:11

Question marks instead of Cyrillic in DomPDF?

You need to generate PDF files. Environment: PHP 7.3, XAMPP, Windows 10, Laravel.
Everything works well, only the problem with the encoding - English letters are displayed normally, but Russian ones do not want - question marks instead of letters. Everything is saved in UTF-8, DomPDF is in the latest version, mbstring is installed. But for some reason he does not want to work with Russian. The main thing is that these question marks take into account the font parameters, I tried to change from the Times New Roman to the courier, the question marks changed their outlines according to the font, i.e. the fonts are loaded. Tried to put built-in DejaVu - everything works fine. Shouldn't Times new Roman be? It’s a system one, I even tried using @font-face to manually create times, pulled these ttf files from the folder with Windows fonts, but in vain.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-03-02
@dimonchik2013

https://stackoverflow.com/questions/990181/dompdf-...
blog.crtweb.ru/?p=1192

A
antonstv, 2022-03-28
@antonstv

https://stackoverflow.com/questions/24412203/dompd...
download load_font.php and place it to the root directory of your project: curl -o load_font.php https://raw.githubusercontent.com/dompdf/utils /mas...
then open load_font.php with your editor and place the correct path to your autoload.inc.php, eg require_once 'lib/dompdf/autoload.inc.php';
Open the command line, go to the root folder of your project, and run the utility with the name of the font you are registering and the path to the TFF file eg php load_font.php SourceSansPro ./pathToYourFolder/lib/dompdf/SourceSansPro- Regular.ttf ./pathToYourFolder/lib/dompdf/SourceSansPro-Bold.ttf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question