WebViewer supports Right-to-Left (RTL) viewing and editing for RTL languages, providing a seamless experience for users who work in languages such as Arabic and Hebrew without additional engineering overhead.
Capabilities for RTL include:
- Modular UI RTL layout
- Arabic, Hebrew, Persian, Urdu language localization in UI with more languages planned
- Natural Text Selection
- Improved Copy/Paste
- Search
- Both PDF and Office Viewing
- Consistent Page Manipulation
Benefits include:
- RTL users can interact with documents naturally.
- Reduces user frustration.
- Increases product usage and value.
- The correct character order, copy/paste, and search functionality is upheld.
- Text selection and highlighting is accurate.
- Content meaning and context is preserved.
- Eliminates the need for third-party tools and workarounds for developers.
When you select a supported RTL language in WebViewer, the entire user interface automatically switches to RTL mode. This switch occurs because WebViewer sets the dir="rtl"
property on the main UI container whenever the language changes to an RTL language.
In RTL mode:
- The layout of headers, panels, and modals is mirrored horizontally.
- Navigation buttons, icons, and menus appear on the opposite side compared to LTR (Left-to-Right) mode.
- All UI elements, including popups and context menus, follow RTL alignment and flow.
This mirroring ensures that the interface feels natural and intuitive for RTL language users.
WebViewer currently supports localization in the WebViewer UI for the following RTL languages:
- Arabic (ar)
- Persian/Farsi (fa)
- Hebrew (he)
- Urdu (ur)
When you choose one of these languages from the language selector in the Settings Menu or set it using the setLanguage API, the UI will automatically switch to RTL mode and the UI will be written in that language.
FreeText Annotations in RTL
When using FreeText annotations in a RTL language:
- The text input field and rendered annotation will follow RTL direction.
- Cursor movement, text alignment, and punctuation behave as expected for RTL languages.
This ensures that FreeText annotations are fully usable and visually correct for RTL documents.
Some things to note about RTL in FreeText Annotations:
RTL Default Font
Starting with WebViewer 11.8, the default font for RTL languages is Noto Sans Arabic, chosen for its broad support of RTL glyphs.
- Text-Alignment: For RTL languages, the default text alignment is right-aligned to match typical typing behavior.
- Font Appearance: Not all fonts will render identically in FreeText annotations when a document is downloaded and re-opened. Font support for RTL scripts (such as Arabic or Hebrew) also varies between fonts and platforms. Browsers and operating systems use locally installed fonts to render text. If a required RTL-supporting font is not available on the system, the browser will substitute a fallback font, which may affect the appearance and readability of RTL text.
- Strict Font Matching: Using enableStrictAnnotationFontMatching will improve the consistency of FreeText annotation appearance between viewing and downloaded versions.
- When strict font matching is enabled, a font will be selected that supports all glyphs in the annotation text.
- For RTL languages, if the selected font does not support the required glyphs, the annotation will fall back to a font that does (ie. Noto Sans Arabic).