Problem with a character

Hi,

I'm trying to insert a '■' in my pdf document but I can't get it. I've tried many ways but I couldn't find the way to do it. Anyone can help me?

PD: the ascii code for this char is 254

Please try the following xml.

<?xml version="1.0" encoding="UTF-8"?>



Test








Wish it could give u an ideal.

I create the pdf in my application, with data covered from several sources. How do I use this xml code with my c# code?

Thanks for considering Aspose.

The following is a sample that illustrate how to use this character by API.

Pdf pdf = new Pdf();
pdf.IsTruetypeFontMapCached = true;
Aspose.Pdf.Section sec1 = pdf.Sections.Add();

Text t1 = new Text(((char)0x25a0).ToString()); // to assign the target character.

t1.Segments[0].TextInfo.FontName = "Times New Roman";
t1.Segments[0].TextInfo.IsUnicode = true;

sec1.Paragraphs.Add(t1);

pdf.Save("Unicode.pdf");

In my version of Aspose.PDF, Pdf class doesn't have a property called IsTrueTypeFontMapCached so I can't try this solution. Upgrade Aspose version is not possible but if anyone knows other solution would be great. By the moment I've changed the symbol ■ in order to continue with my develop, but it would be great if I could put it in the pdf document.

Thanks a lot.

Truetype font map is a font name to font file name map which is used when using unicode. If unicode is used, setting this property to true can make your application run fast. If this property is set to true and the system's fonts are changed (for example, new fonts are installed), delete the font map file (Aspose.Pdf.TruetypeFontMap.xml) and it will be generated again automatically which takes time to create pdf on the fly.

So I think you can get want the expected result without using property IsTrueTypeFontMapCached.

I know what you’re explaining but I don’t have that property in that class. Maybe it’s because I have an older version of the component. So I can’t try the solution above.

Please try the codes below. BTW, which version do you use?

Pdf pdf = new Pdf();
//pdf.IsTruetypeFontMapCached = true;
Aspose.Pdf.Section sec1 = pdf.Sections.Add();

Text t1 = new Text(((char)0x25a0).ToString()); // to assign the target character.

t1.Segments[0].TextInfo.FontName = "Times New Roman";
t1.Segments[0].TextInfo.IsUnicode = true;

sec1.Paragraphs.Add(t1);

pdf.Save("Unicode.pdf");

It works. The question was the:

objSegmentPDF.TextInfo.Unicode = true;

With this line I can use directly de char '■' instead putting the hex code.

Thanks for your help ;)

Editing: Oh, I've just discovered i didn't understand your previos message, where you explined how coulfd I do it without using TrueTypeFontCached. Sorry and thanks again.