iTextSharp中的克罗地亚字母 [英] Croatian letters in iTextSharp
本文介绍了iTextSharp中的克罗地亚字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我还是C#的初学者,我想知道是否可以选择使用iTextSharp在PDF中编写斯拉夫字母č,ć,š,ž。我正在阅读有关它的其他帖子,但我不能将他们的解决方案应用于我的问题,也许这对初学者来说有点复杂。这是我的代码:
I'm still a beginner in C# and I want to know is there an option of writing slavic letters č,ć,š,ž in PDF using iTextSharp. I was reading other posts about it but I can't apply their solution to my problem, maybe it's a bit to complicate to me as a beginner. This is my code:
SaveFileDialog pdfFile = new SaveFileDialog();
pdfFile.Filter = "PDF|*.pdf";
pdfFile.Title = "Spremi PDF";
pdfFile.FileName = "Ispit";
if (pdfFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Document document = new Document(iTextSharp.text.PageSize.LETTER, 25, 25, 35, 35);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(pdfFile.FileName, FileMode.Create));
document.Open();
foreach (List<string> question in questions)
{
document.NewPage();
foreach (string field in question)
{
document.Add(new Paragraph(field));
}
}
document.Close();
}
这段代码可能很简单,也许有很多更好的方法可以做这是我在C#中的第一个代码之一。
This code is maybe to simple and maybe there's a lots of better ways to do this but this is one of my first codes in C#.
推荐答案
我已经解决了我的问题。这是帮助我的代码:
I have solved my problem. This is the code that helped me:
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, false);
Font titleFont = new Font(bf,20);
Font infoFont = new Font(bf,16);
谢谢大家
这篇关于iTextSharp中的克罗地亚字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文