TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sharmila k
NA
62
51.7k
Convert web page content to pdf file in asp.net
Dec 24 2012 2:44 AM
Hi Friend,
I am developing web application form for offer letter issued.
In that web page after i enter all details click button it will show direct print but, i need direct convert that content page(panel)to
PDF
file in asp.net using c# coding.
In that web page i am using calendar control also convert to PDF(inside panel) file.
Please any one give immediate solution.
This is my Coding:
Panel1.Visible = true;
Label1.Text = TextBox1.Text;
Label2.Text = TextBox2.Text;
System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();
dateInfo.ShortDatePattern = "dd/MM/yyyy";
DateTime doj = Convert.ToDateTime(TextBox2.Text, dateInfo);
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();
But it will show Error like this,
Extender control 'CalendarExtender1' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl
How i can solve this error please any one give immediate solution.
Reply
Answers (
3
)
how to upload sdf file in datatable
About Grid view