I'm developing my project using angularjs and php and need to save a certificate which will be generated at the end, Certificate with it's contents is created dynamically but cannot do right click->save as
since it is not an image,
So I used canvas for this, but it doesn't seem to help.
I included this in head tag of my HTML file
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-alpha1/html2canvas.js">
</script>
But still it says "html2canvas is not defined"
MY HTML CODE:
<div class="userCertificate" id="html-content-holder">
<div class="secondborder">
<img src="images/ISRO_Logo.png" height="80px" alt="ISRO_LOGO" style="text-align: left">
<div class="content">
<h2 style="color:#f47216">NATIONAL REMOTE SENSING CENTRE</h2>
<br>
<h1>Certificate Of Appreciation</h1>
<br>
<p>This certificate is awarded to </p>
<h1><span class="Name"> {{studentname}} </span></h1>
<p>from <span class="collegeName">{{collegeName}}</span> for succesfully qualifying online quiz exam with score of <span class="collegeName">{{marks}}</span> %</p>
<p> conducted on 6/06/2019</p>
</div>
<img src="images/stamp.PNG" height="80px" alt="ISRO_LOGO" style="float: right;margin-top: 80px;margin-right: 30px">
</div>
</div>
<input type='button' id='but_screenshot' value='Take screenshot' onclick='screenshot();'>
My Javascript Code:
function screenshot() {
html2canvas(document.getElementById('userCertificate')).then(function(canvas) {
document.body.appendChild(canvas);
});
}