Reputation: 2467
How to capture the active screen in ASP.Net MVC
?
Is there any feature in JQuery for this?
What I am looking for is to save the specific part of screen (say a parent div content) on click of a button and show Print dialog to user which will print this as an image.
I found many posts around but I am looking for MVC & JQuery specific solution.
Can anybody please suggest?
Upvotes: 2
Views: 3016
Reputation: 16613
If it's a screen capture in a rendered page you might want to check out the HTML5 canvas element and capture what's drawn in there: https://stackoverflow.com/a/6887206/90011.
Put this in the view:
<canvas id="graph" width="200" height="150"></canvas>
Javascript part:
// Send the drawn image to the server
$('#sendBtn').live('click', function () {
var image = graph[0].toDataURL("image/png");
image = image.replace('data:image/png;base64,', '');
$.ajax({
type: 'POST',
url: '/Default.aspx/UploadImage',
data: '{ "imageData" : "' + image + '" }',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (msg) {
alert('Image sent!');
}
});
});
Source code was taken from this blog article: Send Canvas Content to Your Server
Upvotes: 1