我想在winform c#中将文本框的字体变成itextsharp basefont。 我还想根据winform中文本框的对齐方式在PDF中对齐文本。
答案 0 :(得分:2)
使用FontFactory.RegisterDirectories()
读取字体。从System.Drawing.Font
获取字体名称,并使用该名称调用FontFactory.GetFont()
。
答案 1 :(得分:0)
您可以使用iTextSharp.text.Font
代替以下内容:
Font font = FontFactory.GetFont("Segoe UI", 18.0f, BaseColor.Black);
如果您System.Drawing.Font
使用以下内容:
System.Drawing.Font systemDrawingFont = new System.Drawing.Font("Segoe UI", 12);
Font font = FontFactory.GetFont(systemDrawingFont.Name, systemDrawingFont.Size, BaseColor.Black);