Hi Sharad,
I didn't checked whatz the problem with your code, but you can use below code to convert html to pdf, it works fine for me and I hope it will work for you also :).
I use ITextSharp dll version 5.1.2.0
private void Converter(string htmlText, string path)
{
Document doc = new Document(PageSize.A4);
try
{
iTextSharp.text.pdf.PdfWriter pdf = (iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(path, FileMode.Create)));
doc.Open();
System.Collections.Generic.List<IElement> htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlText), null);
for (int k = 0; k < htmlarraylist.Count; k++)
{
doc.Add((IElement)htmlarraylist[k]);
}
doc.Close();
}
catch (Exception ex)
{
try
{
doc.Close();
}
catch (Exception e)
{
}
}
}