Reputation: 11
So, I'm basically working on a custom card editor. The user can edit the text (in place), upload a picture and do basic editing (resizing, framing, b&w). This is all done via javascript. When the user is done editing the card, I need to be able to capture a screenshot of the whole page as it is and store it server-side. This is very important - this process is NOT for the user. I want to receive an image or a pdf of the page exactly as the user edited it.
Is this possible in any way?
Thanks.
Upvotes: 1
Views: 363
Reputation: 22247
You won't be able to replicate the user's browser, the plugins, the level of zoom they use, the color of their scrollbars...
I would keep a server-side copy and a client-side copy of the document. When the user does something to the client-side copy, the server-side copy gets updated (maybe an ajax request would supply the information about what changed). Then, you have two similar copies, one of which you can turn into a pdf.
Upvotes: 0
Reputation: 6167
No, there's no way to have the browser make a screenshot and send it to you (which would be the only reliable way). What you can do is save all the states on submit. Your application is javascript written and all they do is manipulate variables like width/height/rotation. If you can dump all the final states of the variables that your script keeps track of you should be able to recreate a static version of the page that is the equivalent of what the user has done with it. How the user's browser has rendered this is an entirely different story.
Upvotes: 1