let's first set the problem of your code aside.
Are you trying to capture the screen of the user?
If so, you must notice that the code you wrote is running on the server, the client just receive the result of the running code. It has nothing to do with the client's screen, and you are capturing the server side's screen. So it's not weird you get a black picture.
And I don't think there is a way to get the user's screen shot.
Hope it clarifies something.