public void pdf()
{
iTextSharp.text.html.simpleparser.StyleSheet styles = new iTextSharp.text.html.simpleparser.StyleSheet();
styles.LoadTagStyle("divM", "border", "2pt solid red");
styles.LoadTagStyle("divM", "size", "60pt");
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Invoice.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
divM.RenderControl(htmlTextWriter);
StringReader sr = new StringReader(stringWriter.ToString());
Document doc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
FontFactory.GetFont("Verdana", 80, iTextSharp.text.BaseColor.RED);
HTMLWorker htmlparser = new HTMLWorker(doc);
htmlparser.SetStyleSheet(styles);
PdfWriter.GetInstance(doc, Response.OutputStream);
doc.Open();
htmlparser.Parse(sr);
doc.Close();
Response.Write(doc);
Response.End();
}
I have tried like this.But my code is not working while applying font size and borders to the pdf using itextsharp.How to modifiy my code please any one help me.