我仍然是C#中的初學者,我想知道是否有使用iTextSharp編寫斯拉夫語字母的選項(PDF格式,ć,š,ž)。我正在閱讀關於它的其他文章,但我無法將他們的解決方案應用於我的問題,也許作爲初學者有點複雜。這是我的代碼:iTextSharp中的克羅地亞字母
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#代碼第一個。
究竟是什麼,你看見了什麼?添加新段落時添加錯誤信息,或添加錯誤字符或...? –
添加到pdf文本沒有這些字母 – PeMaCN
捷克此出(沒有雙關語意):http://stackoverflow.com/questions/26631815/cant-get-czech-characters-while-generating-a-pdf 雖然捷克Croation的解決方案應該是類似的。 –