Nick
Forum Replies Created
-
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Hebrew PDF not shownThe solution that seems working for me:
if (!mb_detect_encoding($text, array(“ASCII”)) && preg_match(“/^\p{Hebrew}+/u”,$text)){
preg_match_all(‘/./us’, $text, $ar);
$text = join(”,array_reverse($ar[0]));
// if there are numbers in the string
// so the next line reverse the number back
// treat also numbers with dot (decimal) and email
$text = preg_replace_callback(‘/\d+-\d+|\d+|\d+\.\d+|\S+@\S+/’, function (array $m) { return strrev($m[0]); }, $text);
}It reverses only pure Hebrew strings.
Thank you Ewout and t3rep.com for your kind help!
Nick.
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Hebrew PDF not shownEwout, Thank you! I really like your plugin, and I’m very sorry to hear that DOMPDF doesn’t support RTL 🙁
t3rep.com, Thank you for your suggestion, but it doesn’t work for me. It will work only if in generated HTML all my Hebrew phrases are inside |direction = “rtl” | style. I don’t have it because I have Hebrew text combined with Russian.
And if I remove the first condition in “if”, all my non-ASCII texts are inverted to RTL, Hebrew (now it looks good) and Russian as well (now is it reversed).
Only if I could write a condition like
if (“all chars in $text are Hebrew (UTF-8 range 0590-05FF)”){
then reverse
}
it could work…Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Hebrew PDF not shownHi Ewout,
Thanks a lot for the quick answer.
I changed URL to local path and the font name and it partially solved my problem. Now I see all the languages in PDF. BUT Hebrew words/phrases are reversed in PDF (for example, instead of “כרטיס אשראי” I get “יארשא סיטרכ”). In HTML the order is correct.Thank you,
Nick.Forum: Plugins
In reply to: [Woo Social Discounts] TranslationOk, thank you! Wainting for your update 🙂