-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoba.txt
52 lines (39 loc) · 1.36 KB
/
coba.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Step 1:- Please add the HTML2CANVAS Cdn in your header file
<!-- HTML 2 CANVAS CDN -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.esm.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.js"></script>
Step 2:- Please add the id's on your content or button
Step 3:- Now add the below script code in your file.
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#download").click(function(){
screenshot();
});
});
function screenshot(){
html2canvas(document.getElementById("photo")).then(function(canvas){
downloadImage(canvas.toDataURL(),"UsersInformation.png");
});
}
function downloadImage(uri, filename){
var link = document.createElement('a');
if(typeof link.download !== 'string'){
window.open(uri);
}
else{
link.href = uri;
link.download = filename;
accountForFirefox(clickLink, link);
}
}
function clickLink(link){
link.click();
}
function accountForFirefox(click){
var link = arguments[1];
document.body.appendChild(link);
click(link);
document.body.removeChild(link);
}
</script>