Xamarin.Forms Syncfusion PDF 数据表不显示西里尔字符

Xamarin.Forms Syncfusion PDF DataTable not showing Cyrillic characters

我正在开发 Xamarin.Forms 用于生成 PDF 文件的应用程序,该应用程序可以在 Syncfusion PDF 库的帮助下支持西里尔字符。这是我的代码示例的一部分:

PdfGrid pdfGrid = new PdfGrid();
Stream f =typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MyApp.ArialUnicodeMS.ttf");
PdfFont font = new PdfTrueTypeFont(f, 124);
//PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20);
DataTable dataTable = new DataTable();
page.Graphics.DrawString("ТЕСТ", font, PdfBrushes.Black, new Syncfusion.Drawing.Point(0, 0));
//Include columns to the DataTable
dataTable.Columns.Add("ТЕСТ1");
dataTable.Columns.Add("ТЕСТ2");
dataTable.Columns.Add("ТЕСТ3");
dataTable.Columns.Add("TEST4");

我用绘图 String 和绘图 PdfGridDataTable

进行测试

绘制字符串时显示 ТЕСТ 并支持西里尔文,但是当我在 DataTable 列中添加西里尔文字符时。 ТЕСТ1 显示空字符串。 有人遇到过类似的问题吗?

我们已经检查了我们这边提供的代码片段,我们必须将支持的字体设置为 dfGrid 样式以在网格单元格内呈现西里尔字符。请最后尝试上面的代码片段,如果它符合您的要求,请告诉我们,

//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();

Stream f = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MyApp.ArialUnicodeMS.ttf");
PdfFont font = new PdfTrueTypeFont(f, 124);

DataTable dataTable = new DataTable();
page.Graphics.DrawString("ТЕСТ", font, PdfBrushes.Black, new Syncfusion.Drawing.Point(0, 0));

//Include columns to the DataTable
dataTable.Columns.Add("ТЕСТ1");
dataTable.Columns.Add("ТЕСТ2");
dataTable.Columns.Add("ТЕСТ3");
dataTable.Columns.Add("TEST4");

//Assign data source.
pdfGrid.DataSource = dataTable;

//Set the font to pdfgrid style
pdfGrid.Style.Font = font;

更多信息请参考下面link,

UG:https://help.syncfusion.com/file-formats/pdf/working-with-tables

注意:我在 Syncfusion 工作。