How to export div content in pdf on button click.
i am facing problem while exporting div data in pdf
i have div in .aspx page like this..
<div id="FoodTokenDiv" runat="server">
<asp:Label ID="lblTab" runat="server">br mode="hold" />
|
.......
in .cs page i create table on this label and whatever i want to show on label after that i do the process of exporting div content in pdf like this...
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TokenForFoodTN" + did + ".pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
FoodTokenDiv.RenderControl(htmlTextWriter);
StringReader stringReader = new StringReader(stringWriter.ToString());
Document Doc = new Document(new RectangleReadOnly(350, (i*10)+200), 5f, 5f, 5f, 5f);
HTMLWorker htmlparser = new HTMLWorker(Doc);
PdfWriter.GetInstance(Doc, Response.OutputStream);
Doc.Open();
htmlparser.Parse(stringReader);
Doc.Close();
Response.Write(Doc);
Response.End();
.......
here in Document Doc line i increase height of the according to data so i use i*10 here 10 is 10px which increase according to i.
please help me...
thanks...