I got a HTML file. and I want to capture certain div as a image.
for instance,
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Capture Image</title>
<style>
.first {
background-color: green;
}
.second {
background-color: blue;
}
</style>
</head>
<body>
<div class='first' style='width: 100px;'>
This is first
</div>
<div class='second' style='width: 200px;'>
And this is second
</div>
</body>
</html>
when I access with jQuery I can get css and contents(with selector + css, selector + text()/val()). However what I wanted is store certain div as an Image.
==> to summarize, I want make only .first
part as an image.
I knew if I use canvas element, I can store as byte stream. But I can not use canvas for this time.
Is there any way I can store such data as a image?
-- P.S
For additional information, in fact, I am trying to store jsPlumb flowchart. There are some samples in web which can store and load via JSON. However I have to load certain chart in different page, storing as an image could be a better way. Thanks for your awesome answer :D