public void convertpdf()
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=UserDetails.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(new Rectangle(1050 ,600));
//Document pdfSTy = new Header(iTextSharp.text.html.Markup.HTML_ATTR_STYLESHEET, "Style.css");
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
i convert the page to pdf using iTextSharp but it cant bring Css style inPdf Coversion code are apove Please help
}
i convert the page to pdf using iTextSharp but it cant bring Css style inPdf Coversion code are apove Please help
Answers
Know the answer? Post it. Somebody with the same question will find it here.