我正在尝试创建一个包含希腊字符的pdf
。但它根本不显示它们。我知道它与字体有关但我找不到正确的方法来打印希腊字符。
这是我的代码:
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
iTextSharp.text.Font font5 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA, 10);
document.Add(new Paragraph("User: " + NameTxt.Value));
如果NameTxt.Value
使用希腊字符,则不会显示
答案 0 :(得分:2)
试试:
string sylfaenpath = Environment.GetEnvironmentVariable("SystemRoot") + "\\fonts\\sylfaen.ttf";
BaseFont sylfaen = BaseFont.CreateFont(sylfaenpath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font normal = new Font(sylfaen, 10f, Font.NORMAL, BaseColor.BLACK);
document.Add(new Paragraph("User: " + NameTxt.Value, normal));