1

Why my pdf don't display polish character?

MemoryStream ms = new MemoryStream();
Pdf pdf = new Pdf(ms);
Section section = pdf.Sections.Add();
var txt = new Text("aąbcćde");
txt.TextInfo.FontName = "calibri";
section.Paragraphs.Add(txt);
pdf.Close();
byte[] bytes = ms.ToArray();
return bytes;
devQwerty
  • 106
  • 1
  • 12

1 Answers1

0

Those special characters are Unicode characters, so you have to make sure that your font supports them and call pdf.SetUnicode(); before pdf.Close.

Timo Salomäki
  • 7,099
  • 3
  • 25
  • 40
  • Ok this work. Other problem: how add custom font? i try use this code: `txt.TextInfo.TruetypeFontFileName = _serverPath + "//Assets//PdfFonts//calibri.ttf"; txt.TextInfo.FontName = "calibri";` but not work – devQwerty Jul 28 '16 at 09:34
  • I'm not sure if the font matching is case sensitive but if it is, you could try this: `txt.TextInfo.FontName = "Calibri";`. Otherwise I suggest you to look at the [documentation](http://www.aspose.com/docs/display/pdfnet/Fonts+embedding+while+creating+PDF) to read more about fonts and embedding them. – Timo Salomäki Jul 28 '16 at 09:41
  • 1
    I'm using the new API in `Aspose.Pdf`, the `Document` class doesn't have `SetUnicode()` method. Any idea? – Saeed Neamati Oct 12 '16 at 07:51