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. Image for the cookie policy date
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
Comments
Minh
Jan 06, 2021

I downloaded the code in the link: https://github.com/syncfusion/xamarin-demos/tree/master/Forms/DataGrid, it's work, but i change target Framework = android 11, app can't export pdf because rule of android 11.

Reply
Pradeep Kumar Balakrishnan [Syncfusion]
Jan 07, 2021

Hi Minh,

As you mentioned the issue occurred only in Android 11. Currently we don’t have the mentioned android 11 device. We will validate the reported issue in the specific environment and update you the details in two business days (January 11, 2021). We appreciate your patience until then.

Regards, Pradeep Kumar B

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