signature pad javascript

Solutions on MaxInterview for signature pad javascript by the best coders in the world

showing results for - "signature pad javascript"
Eduardo
06 Oct 2017
1<script src="https://cdnjs.cloudflare.com/ajax/libs/signature_pad/1.3.5/signature_pad.min.js" integrity="sha512-kw/nRM/BMR2XGArXnOoxKOO5VBHLdITAW00aG8qK4zBzcLVZ4nzg7/oYCaoiwc8U9zrnsO9UHqpyljJ8+iqYiQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
2<script>
3       var canvas = document.getElementById("signature-pad");
4
5       function resizeCanvas() {
6           var ratio = Math.max(window.devicePixelRatio || 1, 1);
7           canvas.width = canvas.offsetWidth * ratio;
8           canvas.height = canvas.offsetHeight * ratio;
9           canvas.getContext("2d").scale(ratio, ratio);
10       }
11       window.onresize = resizeCanvas;
12       resizeCanvas();
13
14       var signaturePad = new SignaturePad(canvas, {
15        backgroundColor: 'rgb(250,250,250)'
16       });
17
18       document.getElementById("clear").addEventListener('click', function(){
19        signaturePad.clear();
20       })
21</script>