• Resolved jamal1wmedia

    (@jamal1wmedia)


    Hi Team,

    “RTL Support – Select this to enable RTL support ( enabling this will enable, font-style : DejaVu Sans, sans-serif globally ) and will support right-to-left text alignment.”


    When I enable this option in the PDF Settings, English and LTR languages – brackets and numbers are not working properly. Can you please investigate this issue?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP Swings

    (@wpswings)

    Hello Jamal,
    Thanks for using our plugin.
    When RTL support is enabled, numbers, letters, and brackets adhere to RTL rules, resulting in their reversal as well. This ensures comprehensive RTL support throughout the content.
    We are always here to assist you.
    Best Regards

    Thread Starter jamal1wmedia

    (@jamal1wmedia)

    Thanks for your reply. Can you please confirm the following statement?

    If RTL is enabled, Even the content is LTR (for Example, English), Numbers, letters and brackets will looks like RTL, when downloading the PDF. Is that correct?

    We are using Arabic (RTL) and English (LTR) with the WPML plugin and some other languages. Can you advise me to overcome this issue? Without RTL support we would not be able to download the Arabic content.

    Jamal

    Plugin Author WP Swings

    (@wpswings)

    Hello,

    It seems like you’re discussing a modification to the PDF generation process for WordPress, particularly with regards to handling RTL (right-to-left) text and mixed content (including Arabic characters, numbers, and letters) in the PDF template files. If you want to enhance the functionality to only apply RTL formatting to Arabic characters while leaving other characters unchanged, you can modify the logic as follows:

    php // pdf-generator-for-wp/package/lib/dompdf/vendor/dompdf/dompdf/src/Renderer/Text.php // line no 83 if (strtolower($style->direction) === 'rtl') { // Separate Arabic characters from the text using a regular expression preg_match_all('/[\p{Arabic}]/u', $text, $arabicCharacters); // Reverse Arabic characters and keep other characters unchanged $text = preg_replace_callback('/[\p{Arabic}]/u', function($match) { return strrev($match[0]); }, $text); // Join Arabic characters with unchanged characters $text = join('',array_reverse($arabicCharacters[0])); }

    Explanation:

    • The regular expression '/[\p{Arabic}]/u' is used to match Arabic characters within the text.
    • We then use preg_replace_callback() to reverse each Arabic character found in the text while leaving non-Arabic characters unchanged.
    • Finally, we join the reversed Arabic characters with other characters and assign the result back to the $text variable.

    This modification ensures that only Arabic characters are reversed for RTL formatting, while other characters such as numbers and letters remain unchanged in their original order.
    Make sure to test this modification thoroughly to ensure it works as expected with your PDF generation process in WordPress.

    Regards,

    • This reply was modified 1 year, 1 month ago by WP Swings.
    Plugin Author WP Swings

    (@wpswings)

    Best Regards

    • This reply was modified 1 year, 1 month ago by WP Swings.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘RTL Option’ is closed to new replies.