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 draw Unicode text in PDF tables

Platform: Xamarin.Forms |
Control: PDF

Syncfusion Essential PDF is a Xamarin PDF library used to create, read, and edit PDF documents. Using this library, you can draw the Unicode text in PDF tables in Xamarin.

Steps to draw Unicode text in PDF table in Xamarin programmatically:

  1. Create a new C# Xamarin.Forms application project. Create new Xamarin.Forms application
  2. Select a project template and required platforms to deploy the application. In this application, to share the portable assemblies across multiple platforms, the .NET Standard code sharing strategy has been selected. For more details about code sharing, refer here.

If .NET Standard is not available in the code sharing strategy, the Portable Class Library (PCL) can be selected.

Seclect Blank App template

  1. Install the Syncfusion.Xamarin.PDF NuGet package as a reference to your Portable/NetStandard project from NuGet.org. Install required Nuget packages
  2. Add new Forms XAML page in portable project if there is no XAML page is defined in the App class. Otherwise, proceed to the next step.
  1. To add a new XAML page, right-click the project and select Add > New Item and add a Forms XAML page from the list. Name it as MainXamlPage.
  2. In App class of portable project (App.cs), replace the existing constructor of App class with the following code snippet, which invokes the MainXamlPage.
    public App()
        //The root page of your application
        MainPage = new MainXamlPage();


  1. In the MainXamlPage.xaml, add new button as follows.
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                 x:Class="GettingStarted. MainXamlPage">
    <StackLayout VerticalOptions="Center">
    <Button Text="Generate PDF Document" Clicked="OnButtonClicked"  HorizontalOptions="Center" VerticalOptions="Center"/>


  1. Include the following namespaces in the MainXamlPage.xaml.cs file.
    using Syncfusion.Pdf;
    using Syncfusion.Pdf.Graphics;
    using Syncfusion.Drawing;
    using Syncfusion.Pdf.Grid;


  1. Add a new folder and name it as Assets and include the supported font file into this folder, and set Build Action to Embedded resource. font
  2. Include the following code snippet in the click event of the button in MainXamlPage.xaml.cs to draw the Unicode text to the PDF file and save it in a stream.
    //Create a new PDF document
    PdfDocument document = new PdfDocument();
    //Add a new PDF page
    PdfPage page = document.Pages.Add();
    //Get the font file as stream
    Stream fontStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("UnicodeText.Assets.arial.ttf");
    //Create a new PdfTrueTypeFont instance
    PdfTrueTypeFont font = new PdfTrueTypeFont(fontStream, 14);
    //Create a new bold stylePdfTrueTypeFont instance
    PdfTrueTypeFont boldFont = new PdfTrueTypeFont(fontStream, 14, PdfFontStyle.Bold);
    page.Graphics.DrawString("PdfGrid", boldFont, PdfBrushes.Black, PointF.Empty);
    //Create PdfGrid
    PdfGrid pdfGrid = new PdfGrid();
    //Add values to list
    List<object> data = new List<object>();
    Object row1 = new { ID = "#E01", Name = "@Clay", Salary= "€2000" };
    Object row2 = new { ID = "#E02", Name = "@Thomas", Salary = "$2000" };
    //Add list to IEnumerable
    IEnumerable<object> dataTable = data;
    //Assign data source
    pdfGrid.DataSource = dataTable;
    //Assign bold font to pdfGrid header
    pdfGrid.Headers[0].Style.Font = boldFont;
    //Assign font to PdfGrid
    pdfGrid.Style.Font = font;
    //Draw grid to the page of PDF document
    PdfGridLayoutResult result= pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(0, 20));
    page.Graphics.DrawString("PdfLightTable", boldFont, PdfBrushes.Black, new PointF(0,result.Bounds.Bottom+10));
    //Declare a PdfLightTable
    PdfLightTable pdfLightTable = new PdfLightTable();
    //Set the Data source as direct
    pdfLightTable.DataSourceType = PdfLightTableDataSourceType.TableDirect;
    //Create columns
    pdfLightTable.Columns.Add(new PdfColumn("ID"));
    pdfLightTable.Columns.Add(new PdfColumn("Name"));
    pdfLightTable.Columns.Add(new PdfColumn("Salary"));
    //Add rows
    pdfLightTable.Rows.Add(new object[] { "#E01", "@Clay", "€2000" });
    pdfLightTable.Rows.Add(new object[] { "#E02", "@Thomas", "$2000" });
    pdfLightTable.Style.ShowHeader = true;
    pdfLightTable.Style.HeaderStyle = new PdfCellStyle();
    pdfLightTable.Style.HeaderStyle.Font = boldFont;
    pdfLightTable.Style.DefaultStyle = new PdfCellStyle();
    pdfLightTable.Style.DefaultStyle.Font = font;
    //Draw the PdfLightTable
    pdfLightTable.Draw(result.Page, new PointF(0,result.Bounds.Bottom+30));
    MemoryStream stream = new MemoryStream();
    //Save the document
    //Close the document
    stream.Position = 0;
    //Save the stream as a file in the device and invoke it for viewing
    Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("Output.pdf", "application/pdf", stream);


  1. Download the helper files from this link and add them into the mentioned project. These helper files saves the stream as a physical file and open the file for viewing.


File Name


Portable project


Represent the base interface for save operation.

iOS Project


Save implementation for iOS device.


Helper class for viewing the PDF file in iOS device.

Android project


Save implementation for Android device.

WinPhone project


Save implementation for Windows Phone device.

UWP project


Save implementation for UWP device.

Windows (8.1) project


Save implementation for WinRT device.



Introduced a new runtime permission model for the Android SDK version 23 and above. So, include the following code for enabling the Android file provider to save and view the generated PDF document.

  • Create a new XML file with the name of provider_path.xml under the Android project Resources folder and add the following code in it. Eg: Resources/xml/provider_path.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <paths xmlns:android="http://schemas.android.com/apk/res/android">
      <external-path name="external_files" path="."/>


  • Add the following code to the AndroidManifest.xml file located under Properties/AndroidManifest.xml.
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.InsertImage">
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
     <application android:label="InsertImage.Android">
        <provider android:name="android.support.v4.content.FileProvider"
          <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
                     android:resource="@xml/provider_paths" />


  1. Compile and execute the application.

By executing the program, you will get the PDF document as follows.

Output pdf file screenshot

Download the complete working sample from UnicodeText.zip

Take a moment to peruse the documentation for using Grid in PDF document, where you will find other options like support for cell customizationrows and columns customizationbuilt-in table styles, and pagination.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.


2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
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