1
다음 코드를 사용하여 C#에서 iText 5를 사용하여 PDF 문서를 만듭니다. 텍스트가 택배 글꼴로 렌더링되지 않습니다. 왜 안돼?courier 글꼴 iText PDF 문서에서 작동하지 않는 이유는 무엇입니까?
private void SimpleFontDoc(string pdfDocPath)
{
Document doc = new Document(PageSize.LETTER, 10, 10, 42, 30);
var fs = new FileStream(pdfDocPath, FileMode.Create);
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
doc.Open();
string[] lines = new string[]
{
"First text line",
"Second text line"
};
var font = FontFactory.GetFont("courier", 12.0f, BaseColor.BLACK);
foreach (var line in lines)
{
var para = new iTextSharp.text.Paragraph(line);
para.Font = font;
doc.Add(para);
}
doc.Close();
}