Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies within .NET ( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Wed Mar 06, 2013 5:51 pm

Is multilingual Unicode text supported in PdfTable? Currently when I try to include jp, ru or zh text, the characters are replaced with question marks (?).

I'm doing a proof of concept to test the ability to do this. I tweaked the "SimpleTable-VS2010" demo code as follows. I did change the font from Arial to Arial Unicode MS and set Unicode to true when creating the font.

I can use the same font outside of the table and it works just fine, but it doesn't appear to work inside of the table.

Code: Select all
//title
PdfBrush brush1 = PdfBrushes.Black;
PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial Unicode MS", 16f, FontStyle.Regular), true);
PdfStringFormat format1 = new PdfStringFormat(PdfTextAlignment.Center);

page.Canvas.DrawString("Список стран", font1, brush1, page.Canvas.ClientSize.Width / 2, y, format1);
y = y + font1.MeasureString("Список стран", format1).Height;
y = y + 5;

String[] data
    = {
        "Name;Capital;Continent;Area;Population",
        "Hello World;en;Hello World;912047;19700000",
        "こんにちは世界;jp;世界;912047;19700000",
        "你好世界;zh;你好世界;176140;3002000",
        "привет мир;ru;привет мир;176140;3002000"
    };

String[][] dataSource
    = new String[data.Length][];
for (int i = 0; i < data.Length; i++)
{
    dataSource[i] = data[i].Split(';');
}

PdfTable table = new PdfTable();
table.Style.CellPadding = 2;
table.Style.HeaderSource = PdfHeaderSource.Rows;
table.Style.HeaderRowCount = 1;
table.Style.ShowHeader = true;
table.DataSource = dataSource;

table.Style.DefaultStyle.Font = font1;

PdfLayoutResult result = table.Draw(page, new PointF(0, y));

rgruetzm
 
Posts: 2
Joined: Wed Mar 06, 2013 4:41 pm

Thu Mar 07, 2013 9:33 am

Dear rgruetzm,

Thanks for your inquiry.
We have reproduced the issue you met. We are sorry for the inconvenience. We have posted it to our dev team. They will do some researches to fix it. Once have any update for this issue, we will tell you immediately.
If you encounter more problems, please feel free to contact us.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2328
Joined: Wed Jun 27, 2012 8:50 am

Thu Mar 07, 2013 4:12 pm

Thank you for your prompt response to my inquiry.

-Ray

rgruetzm
 
Posts: 2
Joined: Wed Mar 06, 2013 4:41 pm

Return to Spire.PDF