D
D
Diversia2016-11-09 13:51:02
PHP
Diversia, 2016-11-09 13:51:02

How to set up mpdf?

Hello.
httpd server 2.4. PHP: 5.6.23. Site on 1C-Bitrix. Runs on UFT-8 (mbstring.func_overload 2).
Downloaded mpdf6. On the page I create a pdf:

$html = 'привет. hello. 123';
require_once $_SERVER['DOCUMENT_ROOT']."/libs/mpdf60/mpdf.php";

$mpdf = new mPDF('utf-8', 'A4', '10', 'Arial');
$mpdf->charset_in = 'utf-8';
$mpdf->WriteHTML($html);
$mpdf->Output();

The output occurs in a downed encoding (krakozyaba). I found in Google that mpdf should be mbstring.func_overload = 0, but this cannot be done, because Bitrix works on mbstring.func_overload = 2.
Please help with a solution.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Oleg, 2016-11-09
@politon

in .htaccess encoding AddDefaultCharset UTF-8
And resave .php files in the same encoding

D
Danbka, 2016-11-09
@Danbka

I did this:
For the folder in which mpdf is located, set mbstring.func_overload = 0. And Bitrix will still work with mbstring.func_overload = 2

N
Nikita, 2016-11-09
@Rema1ns

Diversion

<Directory весь сайт> 
        php_admin_value mbstring.func_overload 2
  php_admin_value mbstring.internal_encoding UTF-8 
</Directory> 

<Directory сайт/пусть до mpdf> 
       php_admin_value mbstring.func_overload 0
</Directory>

F
fr0ntpage, 2017-06-22
@fr0ntpage

So is there a solution? I am also struggling with this problem. VDS from timeweb. I write php_admin_value mbstring.func_overload 0 to the apache config file for the mpdf folder. Phpinfo() returns 0 on the directory. But the pdf is never generated. Only there is to set 0 for the entire directory of the site. But Bitrix swears. I ask for help from those who generate pdf using mpdf60 on Bitrix..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question