Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Nick

    (@nickkkarp)

    The 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.

    Thread Starter Nick

    (@nickkkarp)

    Ewout, 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…

    Thread Starter Nick

    (@nickkkarp)

    Hi 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.

    Thread Starter Nick

    (@nickkkarp)

    Ok, thank you! Wainting for your update 🙂

Viewing 4 replies - 1 through 4 (of 4 total)