3 Replies - 2465 Views - Last Post: 20 February 2013 - 08:38 AM Rate Topic: -----

#1 visweswaran28  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 29-October 09

How to take screen shot of full page in C#.net

Posted 20 February 2013 - 02:44 AM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: How to take screen shot of full page in C#.net

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3529
  • View blog
  • Posts: 10,931
  • Joined: 05-May 12

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.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5464
  • View blog
  • Posts: 11,731
  • Joined: 02-June 10

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.
Was This Post Helpful? 0
  • +
  • -

#4 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4448
  • View blog
  • Posts: 7,744
  • Joined: 08-June 10

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:

  • 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.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1