Unable to cast object of type 'iTextSharp.text.List' to type 'iTextSharp.text.Paragra
Error:
Unable to cast object of type 'iTextSharp.text.List' to type 'iTextSharp.text.Paragraph'.
c# Code:
StringReader SR = new StringReader(strText);
List<IElement> HTML_List = HTMLWorker.ParseToList(SR, null);
for (int k = 0; k < HTML_List.Count; k++)
{
doc.Add((IElement)HTML_List[k]);
}
doc.Close();
}
the value in strTest:
html Code:
"\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n\t<title>\r\n Convert html to pdf using iTextSharp\r\n : The Official Microsoft ASP.NET Forums</title>\r\n\t<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\" />\r\n \r\n\t<link href=\"http://i3.asp.net/common/www-css/i/favicon.ico?cdn_id=20110616-003\" rel=\"shortcut icon\" /> \r\n <link href=\"http://i1.asp.net/fan-cheetah/style/prod-site.min.css?cdn_id=20110616-003\" rel=\"Stylesheet\" type=\"text/css\" media=\"screen\" />\r\n <!--[if lte IE 7]>\r\n <link href=\"http://i1.asp.net/fan-cheetah/style/prod-lt ..... The list goes on
Re: Unable to cast object of type 'iTextSharp.text.List' to type 'iTextSharp.text.Par
Hello,
Which line is throwing the error? And where is doc defined? What type is it?
Gary
Re: Unable to cast object of type 'iTextSharp.text.List' to type 'iTextSharp.text.Par