Question :
I’m building PDF’s, and I need to print a string with special characters. For this I am constructing the string as follows (using iTextSharp
):
PdfPCell teste = new PdfPCell(new Phrase("<O meu texto> 'u20ac'", fontetexto));
Now what matters, my string is "<O meu texto> 'u20ac'"
, where 'u20ac'
has €
. I just want to print a password type point, as the following image shows:
I’m tired of looking for lists with special characters for C # / ASP MVC and I can not find any characters like / , [, ]
for example. How can I build the string with special characters?
Answer :
It may be better to reformulate your code
Take a look at this class:
iTextSharp.text.ListItem
With it you have exactly what you want.
See the example:
it.List list = new it.List(it.List.UNORDERED, 10f);
list.SetListSymbol("u2022");
list.IndentationLeft = 30f;
list.Add(new it.ListItem("One"));
list.Add("Two");
list.Add("Three");
list.Add("Four");
list.Add("Five");
Use:
PdfPCell teste = new PdfPCell(new Phrase("<O meu texto>" + ((char)0x20AC).ToString(), fontetexto));
Edit
The special character of this point you want is U+25CF
, that is:
PdfPCell teste = new PdfPCell(new Phrase(((char)0x25CF).ToString() + " <O meu texto>", fontetexto));
A String is nothing more than a Char Array:
char[] caracteres = {'0x20AC', '0x20AC', '0x20AC'};
string palavra = new string(caracteres);