Posted on: 9/23/2014 7:50:57 PM | Views : 463

Hi All ,
I used following code to create PDF file using Itext sharp.

Dim GridView1 = New GridView GridView1.Font.Name = BaseFont.TIMES_ROMAN GridView1.Font.Size = 8 GridView1.DataSource = ds GridView1.DataBind() Dim sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) GridView1.RenderControl(hw) Dim sr As New StringReader(sw.ToString()) 'Create a table Dim table As New iTextSharp.text.Table(GridView1.Columns.Count) table.Cellpadding = 5 'Set the column widths Dim widths As Integer() = New Integer(ds.Columns.Count - 1) {} For x As Integer = 0 To GridView1.Columns.Count - 1 widths(x) = CInt(GridView1.Columns(x).ItemStyle.Width.Value) Dim cellText As String = _ Server.HtmlDecode(GridView1.Hea ...

Go to the complete details ...