Hi,
I have a web-page, height and width of page exceed the screen size of my display device. I want to take screen shot or print it in pdf of that web-page with that hidden portion too using C#.net.
I don't want to call print dialog box. My requirement is that a User will click a button called "Print", then system should automatically do this above mentioned work.
Please suggest me to proceed.
Thanks in Advance.
How to take screen shot of full page in C#.net
Page 1 of 13 Replies - 553 Views - Last Post: 20 February 2013 - 08:38 AM
Replies To: How to take screen shot of full page in C#.net
#2
Re: How to take screen shot of full page in C#.net
Posted 20 February 2013 - 06:01 AM
If the size of what you want exceeds the size of the screen, how can you call it a screen shot if you want the image to include what is outside the screen? That is like saying I want to get a handful of rice, but what you really want is the entire sack of rice.
#3
Re: How to take screen shot of full page in C#.net
Posted 20 February 2013 - 07:42 AM
Go buy SnagIt. It has a feature to automatically scroll a web browser and keep capturing as it does so. It then makes a single graphic of the entire content as if you were on a monitor 20 feet tall.
#4
Re: How to take screen shot of full page in C#.net
Posted 20 February 2013 - 08:38 AM
Alright. Let's clear up some questions in this post:
If you can use third-party tools, SnagIt is a very good tool. Also, there are addons for each web browser that will do that for free, at least for Firefox and Chrome. I don't know about IE.
If you have to do this yourself, and you want to send the output to the printer, well, you're at the mercy of the web browser itself. The only way you can do printing from the web is to use Javascript to tell the browser to print. The browser handles the dialog. You have no options there.
If you have to do this yourself, and you need the output as an image or a PDF, you do have some options, but it's really not simple. There are some client side options (that rely on HTML5 features, so you'd need shims if this is for older browsers, or it may not work at all):
http://html2canvas.hertzen.com/
And there are some server-side options:
http://www.websitesscreenshot.com/
But again, this isn't going to be simple or perfect. You have to understand the separation of concerns here; for ASP.NET code to do a screenshot, that means it has to happen on the server, which means that the page will have to be rendered again by the server, then captured, then returned. So, the renderer may use different rules than the client browser.
This is not a simple task.
- Do you want this to save an image file, a PDF, or to actually print to a printer?
- Is this a requirement for your application to handle, or can you use a third party tool?
If you can use third-party tools, SnagIt is a very good tool. Also, there are addons for each web browser that will do that for free, at least for Firefox and Chrome. I don't know about IE.
If you have to do this yourself, and you want to send the output to the printer, well, you're at the mercy of the web browser itself. The only way you can do printing from the web is to use Javascript to tell the browser to print. The browser handles the dialog. You have no options there.
If you have to do this yourself, and you need the output as an image or a PDF, you do have some options, but it's really not simple. There are some client side options (that rely on HTML5 features, so you'd need shims if this is for older browsers, or it may not work at all):
http://html2canvas.hertzen.com/
And there are some server-side options:
http://www.websitesscreenshot.com/
But again, this isn't going to be simple or perfect. You have to understand the separation of concerns here; for ASP.NET code to do a screenshot, that means it has to happen on the server, which means that the page will have to be rendered again by the server, then captured, then returned. So, the renderer may use different rules than the client browser.
This is not a simple task.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|