Articles in this section
Category / Section

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

1 min read

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

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Please  to leave a comment
Access denied
Access denied