views:

1188

answers:

7

Hi everyone,

Is there some method to issue a screen capture(browser window content only) from the browser with javascript or a embedded flash object etc so that a full quality image of the page content be saved or printed or an alternative approach.

I have a web app (asp.net 3.5) with google maps and other ajax operations client side like a custom tile server. I have been trying to implement a way for the user to print good quality captures of the webpage.

I have used the basic Window.Print() but in both IE and FF there many artifacts within the google maps and some items such as the popped up bubble doesnt print. I have experimented with save pdf thru cutepdf(just to post an example here) and the quality thru window.print() is low too.

For example, A screenshot with FireShot addon is perfect and what I want the client to have. however that is FF only and I cant ask the clients to install addons/activex controls on their browsers.

Have a look at this download example zip file(4mb) with:

  1. Example screen shot using FireShot (example of what I want to achieve thru a html/JS button with in the page)
  2. Firefox Window.Print() result (cutepdf used to save as pdf)
  3. IE Window.Print() result (cutepdf used to save as pdf)

note in 2,3 the little bubble is not printed even when open.

For now, I have added the function on my site to go fullscreen and guide the user to take a screenshot or call the window.print() function.

I am still looking for a method to print/capture my page.

are there any flash/activex controls that I can include in my page and thru them provide a quality print mechanism?

Thanks again for all the help but I still need more. :)

Thank you in advance.

http://rapidshare.com/files/311849636/Print_examples.zip.html
A: 

I don't think this is possible. It would be quite a security risk to be able to capture the user's screen through scripting (imagine bad sites capturing screen information).

Nate B
I dont want to transmit it to the server but let the user save the image and later print. just what the window.print() does but at a higher quality
Vaibhav Garg
+1  A: 

The only way to reliably provide a high-quality print version of whats on-screen in a rich web application is to use the client-side, say JavaScript, to send the server precise information about the current state (where bubbles are, etc.) and use that to generate an image that mimics the positioning. Convert that image to a PDF or what-have-you, then send to the client for download.

Rex M
that would get overly complicated. specially with google maps. It may not be legal to fetch the tiles on the server. Anyway, in comparison to this method I think I can leave the normal print method in place with a tip to to tell the user that capture screen would produce higher quality...
Vaibhav Garg
+2  A: 

You'll go to all that work only to find that a simple app like Snagit will do the job. Building a SnagIt Screen Capture Plugin

Gerard
+1 For Snagit..I rather like it.
monksy
I dont get it. isnt snagit a software that would have to be installed on the client? It cant be embedded in a webpage?
Vaibhav Garg
I doubt if you'll ever get an embedded object to be able to access the browser's canvas and make it cross-browser, cross-OS compatible. You need something that is running with sufficient OS access to grab the canvas. You say that you've tried cutepdf. Well that isn't embedded either.
Gerard
Sorry, I used cutepdf only to see the print quality from the window.print() command and to post the pdf as sample here to show the missing infowindow from the print and other artifacts
Vaibhav Garg
A: 

For now, I have added the function on my site to go fullscreen and guide the user to take a screenshot or call the window.print() function.

I am still looking for a method to print/capture my page.

are there any flash/activex controls that I can include in my page and thru them provide a quality print mechanism?

Thanks again for all the help but I still need more. :)

Vaibhav Garg
Please update your question instead since this isn't an answer.
svinto
+1  A: 

Google also has a Static Maps API that might give you good results. I looked into it myself once, and only didn't go with it since (at the time) there were limitations on how many points they could support in a polyline.

Paul
Thanks for link. Points limitation should not be a problem since I am using a custom tile layer. I will post feedback if I find it usefull
Vaibhav Garg
A: 

I found mentions of some javascript once that could be used to read images pixel by pixel and possibly send it back to the server which in turn can send back a proper image to save/print.

Any ideas about this?

Vaibhav Garg
Please update your question instead since this isn't an answer.
svinto
A: 

No there is not, though it would come in quite handy at times for bug reporting etcetera.

You will probably get the best result by creating a separate version of the page as a PDF have that being generated. It's no quick fix by all means, but you'll get superb print quality and total control over everything. The map part will probably be a bit tricky though as you need to get the map as a bitmap on the server somehow, and if it's not in flash on the client I don't know how you'd do that.

svinto