We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export Middle Eastern Languages (Arabic, Hebrew) from Xamarin.Forms DataGrid (SfDataGrid) to PDF ?

Platform: Xamarin.Forms |
Control: SfDataGrid |
Published Date: March 10, 2020 |
Last Revised Date: March 20, 2020

By default, exporting Middle Eastern Languages (Arabic, Hebrew) are not supported in PDF document. By setting native language font to PdfTrueTypeFont on CellsExportingEventHandler of DataGridPdfExportingController, you can export the Middle Eastern Languages from SfDataGrid in PDF document.

private void Button_Clicked(object sender, EventArgs e)
        {
           DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
           Stream fontStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DataGridDemo.Amiri-Regular.ttf");
           pdfTrueTypeFont  = new PdfTrueTypeFont(fontStream, 5);
           pdfExport.CellExporting += PdfExport_CellExporting;        }
 
        private void PdfExport_CellExporting(object sender, DataGridCellPdfExportingEventArgs e)
        {
            if (e.CellType == ExportCellType.HeaderCell)
            {
                e.PdfGridCell.Style.Font = pdfTrueTypeFont;
            }
        }

SfDataGrid -PDF exporting

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon