Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
19
Reply
display data in text boxes and export to pdf
kuldeep singh
May 28 2015 2:50 AM
1.1k
Reply
Good Morning Friends,
I have a employee's salary database and i have designed salary slip in web form and displaying data in that form from data base.
When i am exporting the form to pdf it is only exporting the HTML content only, not the data which i have fetched from data base(using show button)
can anyone give me an idea how to export the web form data to pdf(as it is displayed in web form).
my code
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();
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
19
)
Next Recommended Forum
file upload value loses when pressing any buttun on form
Problem in accessing the textboxes in RadGrid cells