We just started using Aspose.pdf version 18.1 to work with right-to-left (RTL) languages, and there are a few things I’m having trouble getting to work correctly. First, the TextEditOptions.LanguageTransformation.Default setting appears to work, in general, for TextFragments. It doesn’t appear to do anything for HtmlFragments, however. Is this expected?
Second, what is the appropriate way to have RTL text appear flush up against the right margin of the page, instead of the left margin (as it would in English and LTR languages)? It doesn’t happen automatically with RTL text, and setting the HorizontalAlignment property to Right winds up chopping parts of letters off when a fragment is long enough to invoke line-wrapping. Specifically, it’s chopping some amount of space off of the right edge of each line except the last line. Here’s an image:
image.png (39.8 KB)
In that image, you can see that if the text is a single line, it looks fine if it’s aligned either left (incorrect for RTL) or right (correct for RTL). But when you extend the fragment so that it wraps, only the left-aligned (incorrect for RTL) text is preserved. The green box around the word الاختبار on the second line shows how this word should look. But if you look at the right-aligned version of this text, you can see (red box) that it’s had the rightmost part of the word chopped off. That same word on the last line of the fragment does not have its rightmost portion chopped off (green box). Playing with margins, padding, etc. does not affect this at all - the rightmost portion can still get chopped off.
Also, if you use the HorizontalAlignment.Justified setting, the RTL language transformation doesn’t seem to work (orange box). I’m not an Arabic speaker, but if you look at the order of the words in the Arabic-justified table cell, they aren’t in the right order compared to the other examples.
I’m sorry if this is long… can you please let me know the following?
- How to properly right-align RTL text without having parts of words chopped off when line-wrapping is invoked?
- If the HtmlFragment is expected to work with RTL?