MeasureString with IText

I want the width of my columns to be automatic, but I know this is not possible, so I try to use the MeasureString function without success.

Here is my code:

 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(); 

I know that I need an object to install the MeasureString function MeasureString , but I don’t know which object.

+1
c # itextsharp
source share
1 answer

Calling GetWidthPoint(string text, float fontSize) on an instance of iTextSharp.text.Font.BaseFont will return the width of the specified string for this particular font.

+2
source share

All Articles