-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscreenshot.js
More file actions
23 lines (22 loc) · 883 Bytes
/
screenshot.js
File metadata and controls
23 lines (22 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Take screenshot of element using HTML2canvas library
function takeShot() {
// Enable display of background text elements
document.getElementById('line1Copy').style.visibility = "visible";
document.getElementById('line2Copy').style.visibility = "visible";
document.getElementById('line3Copy').style.visibility = "visible";
// Clear old output if present
document.getElementById('output').innerHTML = "";
let div =
document.getElementById('signboard');
// Take screenshot
html2canvas(div,{backgroundColor:null}).then(
function (canvas) {
document
.getElementById('output')
.appendChild(canvas);
})
// Rehide background text elements
document.getElementById('line1Copy').style.visibility = "hidden";
document.getElementById('line2Copy').style.visibility = "hidden";
document.getElementById('line3Copy').style.visibility = "hidden";
}