Unicode Symbols in FormattedTextArea

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v9)  /  Re: Unicode Symbols in FormattedTextArea

DynamicPDF CoreSuite for .NET (v9) Forum

 Mar 07 2018 2:58 PM
Hi,

I'm trying to get Unicode symbols to render in a table using the Unicode code symbols and a FormattedTextArea. Each time I try different symbols, it appears that the Unicode Code Point is just rendered "as-is", as if it were just text.

Here is my code (C#)  for adding the text to the PDF:

Font unicodeFont = new OpenTypeFont(@"ARIALUNI.TTF");
FontFamily family = new FontFamily("ArialFont", unicodeFont);
var text = "\\U00C6";
FormattedTextArea area = new FormattedTextArea(text, 0,0,150, 150, family, 14, true);
Row2 newRow = _theTable.Rows.Add(ROWHEIGHT, unicodeFont, ROWFONTSIZE);

newRow.Cells.Add(area);

When this table renders, I get the following text:

"\U00C6"

Am I missing something?

Thanks.
Posted by a ceTe Software moderator
Hello,

When you specify the Unicode hex value as a string use single \ and a lower case “u” as shown below.

var text = "\u00C6";

Thanks,

ceTe Software Support Team.
Thank you so much! This now works!
The following is not working...

        Dim fta As FormattedTextArea = New FormattedTextArea("\u003C LESS-THAN SIGN", 50, 400, 100, 20, FontFamily.Helvetica, 14, True)
        pg.Elements.Add(fta)
Displays

        Dim fta1 As FormattedTextArea = New FormattedTextArea("\u00C6 LESS-THAN SIGN", 50, 450, 100, 20, FontFamily.Helvetica, 14, True)
        pg.Elements.Add(fta1)

In both cases, it is not translating into the specified character. 

I'm using 9.0.0.35070
Posted by a ceTe Software moderator
Hi,

We are looking into this issue and will post an update as soon as we complete our analysis.

Thanks,

ceTe Software Support Team.
Posted by a ceTe Software moderator
Hello,

The Syntax to add the Unicode values with VB.NET is differs from the C# code. Below is the code sample to add the symbol using Unicode values using VB.NET.

Dim fta1 As FormattedTextArea = New FormattedTextArea(ChrW(198) & "Symbol", 50, 450, 100, 20, FontFamily.Helvetica, 14, True)

Please note that if you would like to add the less-than  (& l t ; ) or greater-than (& g t; )symbols to the PDF using FormattedTextArea then please use the HTML entities. Below is the code sample.

Dim fta As FormattedTextArea = New FormattedTextArea("< LESS-THAN SIGN", 50, 400, 200, 20, FontFamily.Helvetica, 14, True)

Dim fta2 As FormattedTextArea = New FormattedTextArea("> GREATER-THAN SIGN", 50, 500, 200, 20, FontFamily.Helvetica, 14, True)

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 11:25 AM.