C# 用IText测量
我希望我的列的宽度是自动大小,但我知道这是不可能的,所以我尝试使用函数C# 用IText测量,c#,itextsharp,C#,Itextsharp,我希望我的列的宽度是自动大小,但我知道这是不可能的,所以我尝试使用函数MeasureString,但没有成功 这是我的密码: Document doc = new Document(PageSize.A4, 20, 20, 72, 72); doc.Open(); PdfPTable t=new PdfPTable(2); //Here I want to know the size of the column. . . . doc.Close(); 我知道我需要一个对象来设置函数Measur
MeasureString
,但没有成功
这是我的密码:
Document doc = new Document(PageSize.A4, 20, 20, 72, 72);
doc.Open();
PdfPTable t=new PdfPTable(2);
//Here I want to know the size of the column.
.
.
.
doc.Close();
我知道我需要一个对象来设置函数
MeasureString
,但我不知道是哪个对象。在iTextSharp.text.Font.BaseFont
的实例上调用GetWidthPoint(string text,float fontSize)
将返回该特定字体的给定字符串的宽度