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.
Unfortunately, activation email could not send to your email. Please try again.

How to embed unsupported fonts while exporting SfDataGrid to PDF?

SfDataGrid exports data to PDF using Syncfusion PDF component. By default, some fonts (such as Unicode font) are not supported in PDF. In this case, it is possible to embed the font in PDF document with the help of PdfTrueTypeFont.

Here, you can see how to embed font into the PDF document. In SfDataGrid, you can customize the content that is to be exported into PDF, by using delegate handlers in the PdfExportingOptions.

The following code illustrates how to set the event to ExportingEventHandler delegate of PdfExportingOptions where you can embed Font.

C#

The following code illustrates how to create a font from the resource file and embed into the font of PdfGridCell cell style in WinRT.

C#

In Silverlight, you can render the stream by using GetResourceStream() method to retrieve the font from the resource file and embed into the font of PdfGridCell cell style as illustrated in the following code example.

C#

In the above code, unicode font embeds into PDF. Therefore, exporting the SfDataGrid with Unicode character is exported to PDF correctly.

SfDataGrid

Figure 1: SfDataGrid

Following is the exported PDF document with Unicode character.

Exported PDF

Figure 2: Exported PDF

Sample link:

You can refer to the following sample links for exporting unsupported fonts from SfDataGrid to PDF document in WPF, WinRT and Silverlight.

WPF: PDFGenerationEuroSymbol_WPF

WRT: PDFGenerationEuroSymbol_WRT

Silverlight: PDFGenerationEuroSymbol_SilverLight

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
2974 11/27/2014 06/08/2015 WPF SfDataGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.