I need to export my ASP webpage , that contains Telerik controls ,some ASP controls, header and footer banner . I want to export everything on this page to a PDF when a button click is done. I triediTextSharp , it allowed only to convert the HTML elemnts to PDF. Is there any free third party stuff for doing this ?
Asked
Active
Viewed 1,628 times
0
-
I suspect you are talking about asp.net webforms not classic asp – Jon P May 02 '12 at 05:36
-
yes, I am talking about the asp.net web form – user1369192 May 02 '12 at 05:55
-
Possible duplicate of: http://stackoverflow.com/questions/564650/convert-html-to-pdf-in-net – YvesR May 02 '12 at 06:40
-
The post is good. But I really dont want to put the URL and then convert it to PDF. Because my url contains query string and they varies. I need to the whole current asp.net web page to PDF – user1369192 May 02 '12 at 08:34
-
@user1369192 Maybe you can tell your customers to use the chrome browser and its "Print PDF" feature, otherwise I do not see how you can get this done without using the url.By the way, the most upvoted answer in the question ["convert html to pdf in net"](http://stackoverflow.com/questions/564650/convert-html-to-pdf-in-net) can handle query strings just fine. – yms May 02 '12 at 13:29
1 Answers
0
You need to get html content of your .aspx page and then you can convert html code to PDF with any 3rd party library. To get the html content of this page you can try something like that:
StringWriter objStringWriter = new StringWriter();
HtmlTextWriter objHtmlWriter = new HtmlTextWriter(objStringWriter);
form1.RenderControl(objHtmlWriter);
string html_sting = objStringWriter.ToString();
Where form1 is your main form on .aspx page.