Writing RTL (Right To Left) text in PDF using PDFNet SDK

Q:

I want to use PDFNet to output some RTL (Right To Left) text in PDF. Do you have sample for this?

Also, do you know if PDF or PDFNet has any issues showing languages that are CTL and RTL based?

A:

PDF format itself does not have any specific support for right-to left languages. Characters within a text run are always placed in left to right order.

So if you want to place some RTL string you should reverse the order of characters in the string.

To determine if a string has any RTL characters you could use the following utility function:

inline bool IsRightToLeftChar(Unicode u) {

return (0x0590 <= u && u <= 0x05FF) || (0x0600 <= u && u <= 0x06FF) || (0x0750 <= u && u <= 0x077F) || (0xFB50 <= u && u <= 0xFDFF) || (0xFE70 <= u && u <= 0xFEFF);

}

PDFNet rasterizers/viewers do not have any issues showing RTL, LTR, or vertical text.