Hi ,
This sample will help you.
Document document = new Document();
string filename = Path.GetTempPath() + "MyFiles.pdf";
StringBuilder strSelectUserListBuilder = new StringBuilder();
strSelectUserListBuilder.Append("<h1>This is my test PDF sample</h1><table border="1" bgcolor="#CCCE0E"> <tr> <td colspan="2">my table</td> </tr> <tr> <td>my table</td> <td>my table</td> </tr> <tr> <td>200</td> <td>100</td> </tr> <tr> <td>500</td> <td>100</td> </tr> <tr> <td>700</td> <td>500</td> </tr></table>");
PdfWriter.GetInstance(document, new FileStream(filename, FileMode.Create));
document.Open();
String htmlText = strSelectUserListBuilder.ToString();
ArrayList htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlText), null);
for (int k = 0; k < htmlarraylist.Count; k++)
{
document.Add((IElement)htmlarraylist[k]);
}
document.Close();
WebClient myWeb = new WebClient();
Byte[] myBuff = myWeb.DownloadData(filename);
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", myBuff.Length.ToString());
Response.BinaryWrite(myBuff);
Response.Flush();
Response.Close();