this is code <div style="font-family: Arial; background-color:black;">This is a test page</div> <div> <table border="1" width="100"> <tr> <td>Name</td> <td>Age</td> </tr> <tr> <td>John</td> <td>11</td> </tr> <tr> <td>Sam</td> <td>13</td> </tr> <tr> <td>Tony</td> <td>12</td> </tr> </table> </div> <div> <asp:Button ID="btnExport" runat="server" Text="Export" OnClick="btnExport_Click" /> </div> and code behind is this protected void btnExport_Click(object sender, EventArgs e) { Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); this.Page.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); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); } file is getting downloaded but background color which i have given in div style="font-family: Arial; background-color:black;">This is a test page</div> is not coming what is the issue !!??
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)