Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I am developing a web application in asp.net. I have totally 32 pages in my application. Along with this i have one master page. I kept Print button in the master page. When a user click on the Print button, i have to print all 32 pages simultaneousely. For this requirement one possible solution could be, i need to have one page in which i have to include all my 32 content page and using window.print. I don't want to do this process. I am expecting another way to proceed. Can anyone help me.

Is it possible to run a background process which calls the 32 pages and save it in a html form in the temporary folder. Later we can read these html file into pdf.
Posted
Updated 15-May-11 22:52pm
v2

Hi,

You could fetch the HTML content of all the 32 pages by using a WebRequest.
Here is an example doing this:
http://www.csharp-station.com/HowTo/HttpWebFetch.aspx[^]

Please be aware of the fact that if you call a page on the server, the request parameters are not the same as the request parameters from the client-request. So perhaps you could copy the request settings (Browser, Cookies) from the original client-request to the request you are executing from the server to get the page as it would be requested by the original client.


Hope this helps.

Best regard and happy coding,
Stops
 
Share this answer
 
Comments
arima.a 16-May-11 9:45am    
I have gone through the link. it gives us the html content. is it possible to convert this html tag into the form of image or other way. so that we can easily push up these things into pdf file.
Christoph Keller 16-May-11 9:52am    
Hi,

Until now, I never had a requirement to render a HTML into a image. Anway, I found the following component which is doing it for you:
http://www.acasystems.com/en/web-thumb-activex/faq-convert-html-to-image-in-asp.net.htm.

Another way would be, that you directly use a PDF component which can render HTML content (or even directly renders a URL into a PDF):
http://www.websupergoo.com/abcpdf-1.htm.

Hope this helps.

Best regards,
Stops
arima.a 16-May-11 10:21am    
Hi, Let me explain my requirement briefly. As i said earlier, i have 32 pages. I am using telerik control(Radchart) for all the pages to populate the data. Each page load event, i am fetching records from database and bind it to my chart control.Each page will have 4 charts. My client is requesting to print all the pages at single click of the button(In this case, only one page is visible). If i need to print a single page i can use window.print.

This is what i am struck up here.
Christoph Keller 16-May-11 10:28am    
As I said in the comment before, I think you need to use an external component.
There are possibilities by using a WebBrowser control, but this is not working in ASP.NET (you would need to create a background worker process using the WebBrowser component).

I only see the following possibilities:
- Use a component that renders a website into a image (example: http://www.acasystems.com/en/web-thumb-activex/faq-convert-html-to-image-in-asp.net.htm)
- Use a PDF component which is capable of rendering HTML input / URL input (example: http://www.websupergoo.com/abcpdf-1.htm).

If you use the above PDF component, you can get through this example:
http://www.websupergoo.com/helppdf8net/default.html?page=source%2F4-examples%2F13-pagedhtml.htm. You can also test if the component is working with your HTML/CSS by using the trial version first (http://www.websupergoo.com/download.htm#pd).

Hope this helps and happy coding,
Stops
Hello Arima,

I think it is really late to ask anything in this thread, but am also stuck with a similar requirement. My requirement is exactly same as yours. So, just wanted to know, do you remember which was the approach you finally picked up.

Was it make it as single page or you could come up with some better logic to do. Please do help me with this issue.

Thank You,
Sushil
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900