Hi I am exporting html to pdf and this work fine but the style applied to my html is missing on the pdf document. This is the code I am using: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ID"] != null) { try { _orderinfo.OrderId = Convert.ToString(Request["ID"]); OrderId = Request["ID"].ToString(); DataSet ds = _orderinfo.getOrderDetailsById(); DateTime today = DateTime.Today; foreach (DataRow dr in ds.Tables[0].Rows) { string OrderReport = string.Format("<table><tr><td style='width: 475px;'><span style='color: firebrick;font-weight: bold;'>Hello</span></td><td></td><td>INVOICE</td></tr>"); OrderReport += string.Format("<tr><td><span style='color: firebrick;font-weight: bold;'>MarketPlace</span></td><td></td><td>Invoice #..............</td></tr>"); OrderReport += string.Format("<tr style='height:50px;'><td>TO:</td><td>SHIP TO:</td><td></td></tr>"); OrderReport += string.Format("<tr><td>{0}</td><td>{1}</td><td></td></tr>", dr["UserName"], dr["UserName"]); OrderReport += string.Format("<tr style='height:100px;'><td><span style='text-transform:uppercase;'>Comments </span></td><td></td><td></td></tr>"); OrderReport += string.Format("<tr style='height:10px;'><td></td><td></td><td></td></tr></table>"); OrderInvoice.Text += OrderReport; } } catch (Exception ex) { Response.Write(ex.ToString()); } } } protected void ExportPDF_Onclick(object sender, EventArgs e) { try { Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=OrderDetails.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(sw); this.Page.RenderControl(tw); StringReader sr = new StringReader(sw.ToString()); Document Orderpdf = new Document(PageSize.A4, 10f, 10f, 50f, 0.0f); HTMLWorker htmlparser = new HTMLWorker(Orderpdf); PdfWriter.GetInstance(Orderpdf, Response.OutputStream); Orderpdf.Open(); htmlparser.Parse(sr); Orderpdf.Close(); Response.Write(Orderpdf); Response.End(); } catch (Exception ex) { Response.Write(ex.ToString()); } } Can some help telling me why the style is not applied to the pdf document.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)