I am using iText for .NET for converting HTML to PDF.
I\'m using HtmlParser to convert an HTML page to PDF, but the problem is that Htmlparser only seems to convert the
I use
StreamReader tempReader = new StreamReader(tempFile);
ArrayList p = HTMLWorker.ParseToList(tempReader,st);
for (int k = 0; k < p.Count; k++)
{
documento.Add((IElement)p[k]);
}
tempReader.Dispose();
documento.Close();
and works fine too. but i put the dispose at the end
Oh i finally got the solution Instead of using htmlparser class i have now used htmlworker class here is the new code
ArrayList p = HTMLWorker.ParseToList(new StreamReader("fck.html"), st);
for (int k = 0; k < p.Count; k++)
{
final.Add((IElement)p[k]);
}
final.Close();
Error 1 Cannot implicitly convert type 'System.Collections.Generic.List' to 'System.Collections.ArrayList'
Use it like this:
List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StreamReader(tempFile),new StyleSheet());
foreach (IElement element in htmlarraylist)
{
document.Add(element);
}