iTextSharp 中的克罗地亚语字母
Croatian letters in iTextSharp
我仍然是 C# 的初学者,我想知道是否可以使用 iTextSharp 在 PDF 中编写斯拉夫字母 č、ć、š、ž。我正在阅读有关它的其他帖子,但我无法将他们的解决方案应用于我的问题,作为初学者,这对我来说可能有点复杂。这是我的代码:
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# 编写的第一批代码之一。
我的问题已经解决了。这是对我有帮助的代码:
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, false);
Font titleFont = new Font(bf,20);
Font infoFont = new Font(bf,16);
谢谢大家
我仍然是 C# 的初学者,我想知道是否可以使用 iTextSharp 在 PDF 中编写斯拉夫字母 č、ć、š、ž。我正在阅读有关它的其他帖子,但我无法将他们的解决方案应用于我的问题,作为初学者,这对我来说可能有点复杂。这是我的代码:
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# 编写的第一批代码之一。
我的问题已经解决了。这是对我有帮助的代码:
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1250, false);
Font titleFont = new Font(bf,20);
Font infoFont = new Font(bf,16);
谢谢大家