Hi,

I am working on .Net 3.5 framework and version 4.1.0.0.
I have a html table, and some controls and gridviews and datalist nested
into it.
When I export the table to pdf, the following error is thrown

Unable to cast object of type 'iTextSharp.text.html.simpleparser.IncCell' to
type 'iTextSharp.text.Rectangle'.

My code for conversion is as below

            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition",
"attachment;filename=EmployeeDetails.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            tblPowerReport.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
            iTextSharp.text.Document pdfDoc = new
iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 8f, 8f, 8f, 8f);

            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);

            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr);            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();

The error is thrown at the bolded area.

While googling out, I observed that one of them have asked to check the
corresponding <tr> <td> tags and the spell check.
Everything has been doubly checked.


Its more than 3 days that this error is haunting me, Tried various tricks,
nothing worked.

Can you please throw upon some light.

Regards
Hema
-- 
View this message in context: 
http://old.nabble.com/Unable-to-cast-object-of-type-%27iTextSharp.text.html.simpleparser.IncCell%27-to-type-%27iTextSharp.text.Rectangle%27.-tp27073611p27073611.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to