Jeckky / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Hebrew Characters don't work! #420

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I tried create a PDF with UTF-8 characters.

What is the expected output? What do you see instead?
I get a '?' character, not characters in hebrew.

What version of dompdf are you using? What version of PHP? On what
operating system?
DOMPDF 0.6.0 beta2
PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch (cli) (built: May  2 2011 23:00:17) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Please provide the HTML source code you want to convert, or any additional
information.

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
    <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body>
                שלום בעולם הזה הוא מבחן.
    </body>
</html>

PHP code
$dompdf = new DOMPDF();
$dompdf->load_html($html, 'UTF-8');
$dompdf->render();
$pdfoutput = $dompdf->output();
$filename = sfConfig::get('sf_web_dir') . '/pdf/report_'.time().'_contract.pdf';
$fp = fopen($filename, "a");
fwrite($fp, $pdfoutput);
fclose($fp); 

Original issue reported on code.google.com by guido.ro...@gmail.com on 7 Feb 2012 at 7:19

GoogleCodeExporter commented 8 years ago
You haven't styled your content with a supporting font. And I would hazard a 
guess that you haven't installed one on your system as well?

Please read over the following documentation:
http://code.google.com/p/dompdf/wiki/CPDFUnicode

Original comment by eclecticgeek on 7 Feb 2012 at 10:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Well, after try one million times, the font that worked is this...

http://www.sbl-site.org/educational/BiblicalFonts_SBLHebrew.aspx

Add to html body
<body style="font-family: sbl, verdana, sans-serif;">

Install font through load_font.php script
php load_font.php sbl hebrew_bi/sbl.ttf

Install font in the Ubuntu system
sudo cp sbl.ttf /usr/share/fonts/truetype/

Thanks for your help eclecticgeek

Original comment by guido.ro...@gmail.com on 8 Feb 2012 at 1:13

GoogleCodeExporter commented 8 years ago
Glad you got it working. Font support will be much easier once we release the 
next beta.

Original comment by eclecticgeek on 8 Feb 2012 at 3:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi i did exactly as written above and i got Hebrew.
The only thing that its written backwards instead of "שם" i got "םש" and no 
rtl support
example in english: "right"->"thgir"
i Attached a file,
And heres the code:
$text = <<< eot
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
    <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body style="font-family: sbl, verdana, sans-serif;">
    נסיון בעברית:<br />
    שם: בודק
    תפקיד: בדקן
    חברה: בדקנות בע"מ
    </body>
</html>
eot;

require_once("pdf/dompdf_config.inc.php");

$html = $text;

$dompdf = new DOMPDF();
$dompdf->load_html($html,'UTF-8');
$dompdf->render();
$dompdf->stream("sample.pdf");

any ideas?

thanks amit

Original comment by emperor...@gmail.com on 14 Feb 2012 at 9:15

Attachments:

GoogleCodeExporter commented 8 years ago
@emporor.iq currently dompdf does not support RTL. It is something we will look 
into in the future. In the meantime you might check out the following related 
thread on the discussion forum. It covers a kludge to get around the issue, but 
the modifications still provide only limited support for RTL.
https://groups.google.com/d/topic/dompdf/qfWb24ct7Ts/discussion

Original comment by eclecticgeek on 14 Feb 2012 at 11:43

GoogleCodeExporter commented 8 years ago
See this function, may be help you...

http://www.php.net/manual/es/function.strrev.php#70381

Original comment by guido.ro...@gmail.com on 23 Feb 2012 at 4:04

GoogleCodeExporter commented 8 years ago

Original comment by eclecticgeek on 30 May 2013 at 5:16