0

Is it possible to create screenshot of browser and send to server

asked 2014-03-07 10:28:48 +0800

emorozovs gravatar image emorozovs
9

Is it possible to create screenshot of browser, ore its some section, and send it back to server using ZK. Or any idea? Thanks

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2014-03-07 12:37:28 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2014-03-07 15:31:49 +0800

you can use java.awt.Robot to "create an image containing pixels read from the screen." You can then write that image to a file on disk.

Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot().createScreenCapture(screenRect);
ImageIO.write(capture, "bmp", new File("filename"));

edit :

Well then you will have to use it in the zul under :

<script defer="true">
</script>
link publish delete flag offensive edit

answered 2014-03-07 14:00:08 +0800

emorozovs gravatar image emorozovs
9

Hi, chillworld! I meant on client side, create a picture of browser content, and than with post method send it to server =)

link publish delete flag offensive edit

answered 2014-03-07 15:51:46 +0800

emorozovs gravatar image emorozovs
9

I am sure that this will not work on client side .. It is very very insecure..

link publish delete flag offensive edit

answered 2014-03-07 16:53:32 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2014-03-10 09:39:35 +0800

Its monday :)

Now for mine code above it doesn't work indeed :), only on local tomcat/jetty
What you can use is :html2canvas.js

What else : You can wire your window, window is seriazable.
You can save it in a DB or file.
So you can load it also again and show it in your "managing place"

pro and con's :

pro picture : * Picture is easier to open and view it.

pro window : * You save it as the state it was so the when remitting your window normally your bug must be also there (or of course external reason of failure like javascript not turned on, cookie corrupted,...)

Now a suggestion to zk is each org.zkoss.zk.ui.AbstractComponent to have an public Image toImage() Taking screenshot(of content browser) is something that should be easy to do.

Hope some other readers agree with me.

Greetz chill.

link publish delete flag offensive edit

answered 2014-03-10 09:58:05 +0800

emorozovs gravatar image emorozovs
9

Hi again. I saw html2canvas too, but this js library is written by single man, also doesn't fully supports css, so it's a black horse, seems should try and see the result. Now I think, it is better to get some component's html (for example window) on clients side and pass to server and than convert this html to pdf, for now I see many html->pdf converters..

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-03-07 10:28:48 +0800

Seen: 35 times

Last updated: Mar 10 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More