How to adjust text encoding in grid pdf export so non standard characters be displayed

Our clients usually use the Central European Windows-1250 text encoding, so we have non-English characters in our language, e.g. Bosnian, Serbian or Croatian (žćčđš ŽĆČĐŠ).

In browsers, the data grids display these characters correctly, but when we export the data grid to PDF, the created PDFs do not have these characters inside.

Is there a way to set the PDF encoding to Windows-1250 or what would be the correct way to encode text in data grids before sending them to the PDF creator?Screenshot 2025-05-22 133927.png


Attachment: KartonPopisneListeDetalji_b750dac2.pdf

1 Reply

VN Vignesh Natarajan Syncfusion Team June 2, 2025 04:28 AM UTC

Greetings from Syncfusion Support,

The reported issue might have occurred when FontFamily is defined wrongly or not supported by default font. By default, we have provided support for very few of the fonts to exported to PDF format. So, to export  any other language or special characters (True type font) to PDF format, we need to set True Type font information as base64 string to FontFamily of PdfGridFont. We have provided support for PdfTrueTypeFont in PdfExport() method.  Using this we can export the different font to pdf format from Grid.


Please apply your corresponding custom TTF as base64 string for the FontFamily. Please use the codes in your application based on your needs, 


 

            PdfThemeStyle RecordThemeStyle = new PdfThemeStyle()

                {

 

 

                    Font = new PdfGridFont { IsTrueType = true, FontSize = 8, FontFamily = "font" },/*you fonts famiy in form of base64string*/

                    FontColor = "#64FA50",

                    FontName = "Calibri",

                    FontSize = 17

 

 

                };

            Theme.Record = RecordThemeStyle;

 



Note : We request you to use the corresponding custom font base64 string in your application, based on your requirement. Please follow the below steps to get the base64 string for the custom font.

  1. Download TTF file for the corresponding (custom) font (https://www.fontsaddict.com/font/category/foreign-greek )
  2. Then convert the TTF file into base64 string (https://www.giftofspeed.com/base64-encoder/).
  3. Finally apply the base64 string to pdfTrupetypeFont.


If you are still facing the issue, kindly get back to us with issue reproducible sample or share the details about your FontFamily to validate the issue further at our end.


Loader.
Up arrow icon