We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RightToLeft (RTL) lang support broken for pdf?

Hi.


I’m trying to export to pdf using RTL functionality, ie for RTL languages such as arabic. There is quite a few “IsRightToLeft” flags and I’m basically just setting all of them for now. However, it doesn’t seem to do anything at all.

Here is some example/test code for a simple table:
Table table = paragraph as Table;
foreach (Row row in table.Rows) {
foreach (Cell cell in row.Cells) {
foreach (Paragraph cellParagraph in cell.Paragraphs) {
Text text = cellParagraph as Text;
foreach (Segment segment in text.Segments) {
segment.TextInfo.IsRightToLeft = true;
}
}
}
}

I also tried the following properties:
Pdf pdf = new Pdf();
pdf.IsRightToLeft = true;
pdf.IsRtlInSegmentMode = true;
pdf.TextInfo.IsRightToLeft = true;
foreach (Section section in pdf.Sections) {
section.TextInfo.IsRightToLeft = true;
}

What I expect to happen is that the text alignment should probably change and that cells for the table should be in reverse order. Same as the attached screenshot in this forum post.

What is actually happening is nothing. It looks exactly the same as it did without setting any of these properties. What am I missing?

I also tried to use the newer syntax, ie instead of Aspose.Pdf.Generator.Table I use Aspose.Pdf.Table etc. I don’t know how feasible it is for us to refactor right now, so my priority is to get an answer on how to do this with the code as per my original post, but I thought it was worth trying it at least.


Although I managed to create and export the same test table using the new syntax, I’m then completely stuck in regards to how I should apply the RTL properties. Unlike the original syntax where we had multiple “isRightToLeft” properties, I was now only able to find one which seems like it might be applicable. Specifically, document.Direction = Direction.R2L. Setting it does however not seem to have any affect. Which properties am I supposed to be setting to make it work?

Hi Tom,


Thanks for contacting support.

I have gone through your requirement description but in order to understand the requirement from visual perspective, I am afraid the image shared in referenced forum thread appears to be missing. Can you please share another image file or sample document, so that we can reply accordingly.

Hi.


I’ve attached a screenshot showing how the simple export example looks like in word. In pdf it always looks like the LTR image even when setting all those flags I listed in the first post. I can see no difference when setting the rightToLeft flags, either using our current syntax (first post) or the new syntax (second post).

PS: It looks like my other thread (link in first post) was moved to a different forum section, so there might be some overlap between that and this thread now. Feel free to answer either here or in the other thread, whichever is more suitable. Sorry about that.

Thank you

Hi Tom,


Thanks for sharing the details.

I have tested the scenario and have managed to reproduce that RTL is currently not supported. For the sake of correction, I have logged it as PDFNET-42261 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.