Problems Applying Right-to-Left Rendering in WPF PDF Viewer? | Syncfusion Blogs
Detailed Blog page Skeleton loader
Problems Applying Right-to-Left Rendering in WPF PDF Viewer?

If applying internationalization in a WPF PDF viewer is a problem for you, then we have a solution to it. The Syncfusion WPF PDF Viewer makes it simple to apply internationalization, right-to-left layouts, with easy steps. You can also read, search, select, and copy RTL language content.

Let’s first see what internationalization is and its importance in the global market. We shall also look into the role of RTL support in the internationalization process of a product. Later, we shall see the procedure to apply RTL rendering to the Syncfusion WPF PDF Viewer.

Internationalization

Internationalization (also called i18n) is a design process that makes your product adaptable to different cultures and countries in the world. Since the market for many products is global, it is possible that potential customers of your product might have different cultures and use different languages than yours.

Considering the possible international scenarios for your product while handling user input, RTL support will definitely improve the experience of your customers. In this way, developing an internationalized product can differentiate yours from your competitors’ products. It gives your product more benefits in the global market than those that are not world-ready.

Internationalization support in our PDF Viewer for WPF also increases the potential of the products using it, as it offers support for multiple languages and does not require changes in the code to apply them.

Right-to-left (RTL) functionality

Right-to-left (RTL) functionality is considered an accessibility feature for a product and it plays a major role in the internationalization process. Some languages with a large number of speakers, such as Arabic and Persian, have right-to-left (RTL) writing systems. To address the requirements of RTL language users, it is very important to make the layout of the UI elements able to render in RTL.

It is also necessary for an RTL product to be localized so that the users in the specific region can get the contents that make sense for their culture. The process of translation and adapting to a specific locale is called localization (also called l10n).

Applying right-to-left functionality to WPF PDF Viewer

You can apply RTL functionality for WPF PDF Viewer in a single step by setting the FlowDirection property of PdfViewerControl to RightToLeft. This switches the layout of the PDF Viewer to right to left. It will improve the user experience and accessibility for the users who use RTL languages. It also allows you to search, select, and copy RTL language text. Refer to the following code example to apply the RTL support for WPF PDF Viewer.

<Window 
     x:Class="PdfViewerDemo.MainWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     Title="PDF Viewer" WindowState="Maximized"
     xmlns:syncfusion="clr-namespace:Syncfusion.Windows.PdfViewer;assembly=Syncfusion.PdfViewer.WPF">
     <Grid x:Name="HomeGrid">
         <syncfusion:PdfViewerControl x:Name="pdfViewer" FlowDirection="RightToLeft"/>
     </Grid>
 </Window>

To provide a completely native look and feel for RTL users, you need to configure the application to the specific RTL language and culture (localization), as mentioned earlier. Our Syncfusion WPF PDF Viewer supports localization, allowing you to localize all the static text used for the UI elements. All you need is to add the desired language-specific resource file in the application, use the following code sample to localize your application, and configure it to different languages (e.g., ar- AE for Arabic).

using System;
using System.Threading;

namespace PDFViewerRTL
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        # region Constructor
        public MainWindow()
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar-AE");
            InitializeComponent();
        }
        # endregion
    }
}

RTL Support in WPF PDF ViewerRefer to this UG documentation for how to create the resource files and add them to your WPF application. You can also find an example WPF PDF Viewer project that is configured to RTL settings in this GitHub repository.

Conclusion

Thank you for reading this blog. I hope that you have enjoyed learning about the importance of internationalization for a product and how easy it is to apply RTL functionality to the WPF PDF Viewer. Try using our PDF Viewer in your application and share your feedback in the comment section below.

For existing customers, the new version of Essential Studio®® is available for download from the License and Downloads page. If you are not yet a Syncfusion customer, you can try our 30-day free trial to check out our available features. Also, try our samples from this GitHub location.

You can also contact us through our support forumDirect-Trac, or feedback portal. We are always happy to assist you!

Be the first to get updates

Deepak G

Meet the Author

Deepak G

Deepak is a Product Manager at Syncfusion with specialized skills in XAML, MVVM, and Windows platform-based controls. In 2014, he started his career as a Software Developer and has become a technophile.