1

i have tried feew things but not working.. here it is my code

 <table cellpadding="2" cellspacing="0" style="background-color: #fcfcfc; border: 10px solid #d9e8ef; width: 100%; border-radius: 5px" 
                        id="tb_header" runat="server">
                        <tr>
                            <td align="right">
                                <span style="font-weight: bold; font-size: 27pt; font-family: Verdana">TAX INVOICE</span>
                            </td>
                        </tr>
                    </table>

it is not taking embedded css. what i am doing wrong?

and here it is my c#

Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        tb_header.RenderControl(hw);
        StringReader sr = new StringReader(sw.ToString());
        Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
        HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream);

        var ms = new MemoryStream();
        pdfDoc.Open();

        htmlparser.Parse(sr);
        pdfDoc.Close();
        Response.Write(pdfDoc);
        Response.End();
  • What are you doing wrong? You are using `HTMLWorker` instead of XML worker! Please read the chapter entitled "Parsing XML and XHTML" in [The Best iText Questions on StackOverflow](http://pages.itextpdf.com/ebook-stackoverflow-questions.html) for examples. – Bruno Lowagie Mar 04 '15 at 13:55
  • possible duplicate of [How to convert HTML to PDF using iTextSharp](http://stackoverflow.com/questions/25164257/how-to-convert-html-to-pdf-using-itextsharp) – Chris Haas Mar 04 '15 at 14:02
  • @criss i have gone through that thread. thing is that i have done everything right as said in that thread. matter is that, it is not supported few properties i feel. like is is not supported bacjground-color.. so i just want to check that property is not supported or i am doing something wrong.. – Abhijeet Bagul Mar 05 '15 at 07:16

0 Answers0