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.

ejGrid export to pdf,but chinese character is empty character.

Thread ID:

Created:

Updated:

Platform:

Replies:

125727 Sep 7,2016 03:39 AM Sep 15,2016 08:16 AM JavaScript 1
loading
Tags: ejGrid
tmzl
Asked On September 7, 2016 03:39 AM

GridProperties obj = ConvertGridObject(gridModel);
            PdfExport exp = new PdfExport();
            IList<Notice> noticeList = new List<Notice>();
            noticeList.Add(new Notice()
            {
                NoticeTitle = "阿斯蒂芬",
                NoticeType = "teast"
            });
            noticeList.Add(new Notice()
            {
                NoticeTitle = "test2",
                NoticeType = "asdf"
            });
            IEnumerable<Notice> result = noticeList;
            
            exp.Export(obj, result, "Export.pdf"falsefalsetrue"flat-saffron");

Thank you!

Mani Sankar Durai [Syncfusion]
Replied On September 15, 2016 08:16 AM

Hi tmzl, 

 We are sorry for the late response. 

We have analyzed your query and achieved your requirement by using ServerPdfQueryCellInfo of Exporting server events. We have changed the font name as “Arial Unicode MS” to show the Chinese character while exporting into PDF. 
 
Please refer the below code example, 
[HomeController.cs] 
public void ExportToPdf(string GridModel) 
        { 
            PdfExport exp = new PdfExport(); 
            List<Person> Persons = new List<Person>(); 
            Persons.Add(new Person() { FirstName = "阿斯蒂芬", LastName = "Beckett" }); 
            Persons.Add(new Person() { FirstName = "Ben", LastName = "Beckett" }); 
            Persons.Add(new Person() { FirstName = "阿斯蒂芬", LastName = "阿斯蒂芬" }); 
            GridProperties obj = ConvertGridObject(GridModel); 
            var DataSource = Persons; 
            obj.ServerPdfQueryCellInfo = QueryCellInfo; 
            exp.Export(obj, DataSource, "Export.pdf", false, false,true, "flat-saffron"); 
        } 
        public void QueryCellInfo(object currentCell) 
        { 
            Syncfusion.Pdf.Grid.PdfGridCell range = (Syncfusion.Pdf.Grid.PdfGridCell)currentCell; 
            range.Style.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial Unicode MS", 12f), true); 
        } 
 
Before exporting into PDF the QueryCellInfo will get triggered to change and access the particular cell information. 
 
We have also prepared a sample that can be downloaded from the below link, 
 
Also please refer the documentation of how we can Export Server events 
Please let us know if you need further assistance. 
 
Regards, 
Manisankar Durai. 
 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;