2013-04-02 63 views
1

我想我列的寬度自動調整大小,但我知道這是不可能的,所以我儘量用功能MeasureString使用沒有成功。MeasureString與iText的

這裏是我的代碼:

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就可以了,但我不知道是哪個對象。

回答

2

iTextSharp.text.Font.BaseFont的實例上調用GetWidthPoint(string text, float fontSize)將返回該特定字體的給定字符串的寬度。

+0

只適用於AGPL許可版本 – fubo