iTextSharp and special characters (slovak graphemes)

半腔热情 提交于 2019-12-05 07:45:50

The problem is here:

BaseFont.CreateFont(BaseFont.HELVETICA ...

BaseFont.HELVETICA is a standard type 1 font and can't be used for your slovak characters. You need to use a font with the correct glyphs:

string FONT = "c:/windows/fonts/arialbd.ttf";
using (Document document = new Document()) {
  PdfWriter.GetInstance(document, STREAM);
  document.Open();
  BaseFont bf = BaseFont.CreateFont(
    FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED
  );
  document.Add(new Paragraph("č, ň and ť", new Font(bf, 12)));
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!