Document document = new Document(PageSize.LETTER, 10, 10, 10, 10);
StringReader reader = new StringReader(edittedHTML);
HTMLWorker worker = new HTMLWorker(document);
string fileName = "test.pdf";
PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
document.Open();
worker.Parse(reader);
worker.EndDocument();
worker.Close();
document.Close();
When the program runs to worker.Parse, it throws out an error just like the title said.
The edtted HTML is the HTML string of an HTML page.
Anyone know how to solve this, or what is going wrong?
The stack trace:
at iTextSharp.text.html.simpleparser.HTMLWorker.StartElement(String tag, IDictionary`2 attrs) at iTextSharp.text.xml.simpleparser.SimpleXMLParser.ProcessTag(Boolean start) at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Go(TextReader reader) at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Parse(ISimpleXMLDocHandler doc, ISimpleXMLDocHandlerComment comment, TextReader r, Boolean html) at iTextSharp.text.html.simpleparser.HTMLWorker.Parse(TextReader reader) at TestPdfApplication.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\TLiu\Documents\Visual Studio 2010\Projects\TestPdfApplication\TestPdfApplication\Form1.cs:line 68
HTMLWorkerthis questions focuses on has been deprecated a long time ago due to numerous issues. Thus, that large audience had better switch to using the replacement classXmlWorker.