{"id":8741,"date":"2024-01-20T17:55:00","date_gmt":"2024-01-20T17:55:00","guid":{"rendered":"https:\/\/codehim.com\/?p=8741"},"modified":"2024-01-22T15:55:47","modified_gmt":"2024-01-22T10:55:47","slug":"javascript-signature-pad-code-with-example","status":"publish","type":"post","link":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/","title":{"rendered":"JavaScript Signature Pad Code with Example"},"content":{"rendered":"<p>This JavaScript code implements a Signature Pad that allows users to draw signatures using a mouse or touch input. It includes features like saving the drawn signature as an image, clearing the canvas, and toggling the display of drawing points.<\/p>\n<p>The main functionality of this code is to provide a signature drawing pad with options for customization such as pen color, background color, and line thickness. It also includes the ability to show or hide the drawing points for a better user experience.<\/p>\n<p>This code is helpful for anyone who needs to implement a signature capture feature on a web application or website, such as for signing contracts or documents electronically.<\/p>\n<h2>How to Create Javascript Signature Pad Code With Example<\/h2>\n<p>1. In your HTML file, include the following code for the signature pad section:<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;section class=\"signature-component\"&gt;\r\n  &lt;h1&gt;Draw Signature&lt;\/h1&gt;\r\n  &lt;h2&gt;with mouse or touch&lt;\/h2&gt;\r\n\r\n  &lt;canvas id=\"signature-pad\" width=\"400\" height=\"200\"&gt;&lt;\/canvas&gt;\r\n\r\n  &lt;div&gt;\r\n    &lt;button id=\"save\"&gt;Save&lt;\/button&gt;\r\n    &lt;button id=\"clear\"&gt;Clear&lt;\/button&gt;\r\n    &lt;button id=\"showPointsToggle\"&gt;Show points?&lt;\/button&gt;\r\n  &lt;\/div&gt;\r\n  \r\n  &lt;p&gt;\r\n    &lt;br \/&gt;\r\n    &lt;a href=\"https:\/\/codepen.io\/kunukn\/pen\/bgjzpb\/\" target=\"_blank\"&gt;Throttling without lag example here&lt;\/a&gt;&lt;br \/&gt;\r\n    &lt;br \/&gt;    \r\n    &lt;a href=\"https:\/\/github.com\/szimek\/signature_pad\" target=\"_blank\"&gt;Signature Pad&lt;\/a&gt; with custom Simplifying and Throttling\r\n  &lt;\/p&gt;\r\n&lt;\/section&gt;<\/pre>\n<p>2. Next, include the following CSS code to style the signature pad. You can customize the styling according to your preferences.<\/p>\n<pre class=\"prettyprint linenums lang-css\">*,\r\n:before,\r\n:after {\r\n  box-sizing: border-box;\r\n}\r\n\r\nhtml {\r\n  font: 18px \"Helvetica Neue\", sans-serif;\r\n}\r\n\r\nbody {\r\n  text-align: center;\r\n}\r\n\r\n.signature-component {\r\n  text-align: left;\r\n  display: inline-block;\r\n  max-width: 100%;\r\n}\r\n.signature-component h1 {\r\n  margin-bottom: 0;\r\n}\r\n.signature-component h2 {\r\n  margin: 0;\r\n  font-size: 100%;\r\n}\r\n.signature-component button {\r\n  padding: 1em;\r\n  background: transparent;\r\n  box-shadow: 2px 2px 4px #777;\r\n  margin-top: 0.5em;\r\n  border: 1px solid #777;\r\n  font-size: 1rem;\r\n}\r\n.signature-component button.toggle {\r\n  background: rgba(255, 0, 0, 0.2);\r\n}\r\n.signature-component canvas {\r\n  display: block;\r\n  position: relative;\r\n  border: 1px solid;\r\n}\r\n.signature-component img {\r\n  position: absolute;\r\n  left: 0;\r\n  top: 0;\r\n}<\/pre>\n<p>3. Load the <a href=\"https:\/\/underscorejs.org\/\" target=\"_blank\" rel=\"noopener\">Underscore JS<\/a> by adding the following scripts before closing the body tag:<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;script src='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/underscore.js\/1.8.3\/underscore-min.js'&gt;&lt;\/script&gt;<\/pre>\n<p>4. Finally, include the following JavaScript code at the end of your HTML file or in an external JavaScript file. This code initializes the signature pad, sets up event listeners for saving, clearing, and toggling points, and handles drawing functionality.<\/p>\n<pre class=\"prettyprint linenums lang-js\">\/*!\r\n * Modified\r\n * Signature Pad v1.5.3\r\n * https:\/\/github.com\/szimek\/signature_pad\r\n *\r\n * Copyright 2016 Szymon Nowak\r\n * Released under the MIT license\r\n *\/\r\nvar SignaturePad = (function(document) {\r\n    \"use strict\";\r\n\r\n    var log = console.log.bind(console);\r\n\r\n    var SignaturePad = function(canvas, options) {\r\n        var self = this,\r\n            opts = options || {};\r\n\r\n        this.velocityFilterWeight = opts.velocityFilterWeight || 0.7;\r\n        this.minWidth = opts.minWidth || 0.5;\r\n        this.maxWidth = opts.maxWidth || 2.5;\r\n        this.dotSize = opts.dotSize || function() {\r\n                return (self.minWidth + self.maxWidth) \/ 2;\r\n            };\r\n        this.penColor = opts.penColor || \"black\";\r\n        this.backgroundColor = opts.backgroundColor || \"rgba(0,0,0,0)\";\r\n        this.throttle = opts.throttle || 0;\r\n        this.throttleOptions = {\r\n            leading: true,\r\n            trailing: true\r\n        };\r\n        this.minPointDistance = opts.minPointDistance || 0;\r\n        this.onEnd = opts.onEnd;\r\n        this.onBegin = opts.onBegin;\r\n\r\n        this._canvas = canvas;\r\n        this._ctx = canvas.getContext(\"2d\");\r\n        this._ctx.lineCap = 'round';\r\n        this.clear();\r\n\r\n        \/\/ we need add these inline so they are available to unbind while still having\r\n        \/\/  access to 'self' we could use _.bind but it's not worth adding a dependency\r\n        this._handleMouseDown = function(event) {\r\n            if (event.which === 1) {\r\n                self._mouseButtonDown = true;\r\n                self._strokeBegin(event);\r\n            }\r\n        };\r\n\r\n        var _handleMouseMove = function(event) {\r\n           event.preventDefault();\r\n            if (self._mouseButtonDown) {\r\n                self._strokeUpdate(event);\r\n                if (self.arePointsDisplayed) {\r\n                    var point = self._createPoint(event);\r\n                    self._drawMark(point.x, point.y, 5);\r\n                }\r\n            }\r\n        };\r\n\r\n        this._handleMouseMove = _.throttle(_handleMouseMove, self.throttle, self.throttleOptions);\r\n        \/\/this._handleMouseMove = _handleMouseMove;\r\n\r\n        this._handleMouseUp = function(event) {\r\n            if (event.which === 1 &amp;&amp; self._mouseButtonDown) {\r\n                self._mouseButtonDown = false;\r\n                self._strokeEnd(event);\r\n            }\r\n        };\r\n\r\n        this._handleTouchStart = function(event) {\r\n            if (event.targetTouches.length == 1) {\r\n                var touch = event.changedTouches[0];\r\n                self._strokeBegin(touch);\r\n            }\r\n        };\r\n\r\n        var _handleTouchMove = function(event) {\r\n            \/\/ Prevent scrolling.\r\n            event.preventDefault();\r\n\r\n            var touch = event.targetTouches[0];\r\n            self._strokeUpdate(touch);\r\n            if (self.arePointsDisplayed) {\r\n                var point = self._createPoint(touch);\r\n                self._drawMark(point.x, point.y, 5);\r\n            }\r\n        };\r\n        this._handleTouchMove = _.throttle(_handleTouchMove, self.throttle, self.throttleOptions);\r\n        \/\/this._handleTouchMove = _handleTouchMove;\r\n\r\n        this._handleTouchEnd = function(event) {\r\n            var wasCanvasTouched = event.target === self._canvas;\r\n            if (wasCanvasTouched) {\r\n                event.preventDefault();\r\n                self._strokeEnd(event);\r\n            }\r\n        };\r\n\r\n        this._handleMouseEvents();\r\n        this._handleTouchEvents();\r\n    };\r\n\r\n    SignaturePad.prototype.clear = function() {\r\n        var ctx = this._ctx,\r\n            canvas = this._canvas;\r\n\r\n        ctx.fillStyle = this.backgroundColor;\r\n        ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n        ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n        this._reset();\r\n    };\r\n\r\n    SignaturePad.prototype.showPointsToggle = function() {\r\n        this.arePointsDisplayed = !this.arePointsDisplayed;\r\n    };\r\n\r\n    SignaturePad.prototype.toDataURL = function(imageType, quality) {\r\n        var canvas = this._canvas;\r\n        return canvas.toDataURL.apply(canvas, arguments);\r\n    };\r\n\r\n    SignaturePad.prototype.fromDataURL = function(dataUrl) {\r\n        var self = this,\r\n            image = new Image(),\r\n            ratio = window.devicePixelRatio || 1,\r\n            width = this._canvas.width \/ ratio,\r\n            height = this._canvas.height \/ ratio;\r\n\r\n        this._reset();\r\n        image.src = dataUrl;\r\n        image.onload = function() {\r\n            self._ctx.drawImage(image, 0, 0, width, height);\r\n        };\r\n        this._isEmpty = false;\r\n    };\r\n\r\n    SignaturePad.prototype._strokeUpdate = function(event) {\r\n        var point = this._createPoint(event);\r\n        if(this._isPointToBeUsed(point)){\r\n            this._addPoint(point);\r\n        }\r\n    };\r\n\r\n    var pointsSkippedFromBeingAdded = 0;\r\n    SignaturePad.prototype._isPointToBeUsed = function(point) {\r\n        \/\/ Simplifying, De-noise\r\n        if(!this.minPointDistance)\r\n            return true;\r\n\r\n        var points = this.points;\r\n        if(points &amp;&amp; points.length){\r\n            var lastPoint = points[points.length-1];\r\n            if(point.distanceTo(lastPoint) &lt; this.minPointDistance){\r\n                \/\/ log(++pointsSkippedFromBeingAdded);\r\n                return false;\r\n            }\r\n        }\r\n        return true;\r\n    };\r\n\r\n    SignaturePad.prototype._strokeBegin = function(event) {\r\n        this._reset();\r\n        this._strokeUpdate(event);\r\n        if (typeof this.onBegin === 'function') {\r\n            this.onBegin(event);\r\n        }\r\n    };\r\n\r\n    SignaturePad.prototype._strokeDraw = function(point) {\r\n        var ctx = this._ctx,\r\n            dotSize = typeof(this.dotSize) === 'function' ? this.dotSize() : this.dotSize;\r\n\r\n        ctx.beginPath();\r\n        this._drawPoint(point.x, point.y, dotSize);\r\n        ctx.closePath();\r\n        ctx.fill();\r\n    };\r\n\r\n    SignaturePad.prototype._strokeEnd = function(event) {\r\n        var canDrawCurve = this.points.length &gt; 2,\r\n            point = this.points[0];\r\n\r\n        if (!canDrawCurve &amp;&amp; point) {\r\n            this._strokeDraw(point);\r\n        }\r\n        if (typeof this.onEnd === 'function') {\r\n            this.onEnd(event);\r\n        }\r\n    };\r\n\r\n    SignaturePad.prototype._handleMouseEvents = function() {\r\n        this._mouseButtonDown = false;\r\n\r\n        this._canvas.addEventListener(\"mousedown\", this._handleMouseDown);\r\n        this._canvas.addEventListener(\"mousemove\", this._handleMouseMove);\r\n        document.addEventListener(\"mouseup\", this._handleMouseUp);\r\n    };\r\n\r\n    SignaturePad.prototype._handleTouchEvents = function() {\r\n        \/\/ Pass touch events to canvas element on mobile IE11 and Edge.\r\n        this._canvas.style.msTouchAction = 'none';\r\n        this._canvas.style.touchAction = 'none';\r\n\r\n        this._canvas.addEventListener(\"touchstart\", this._handleTouchStart);\r\n        this._canvas.addEventListener(\"touchmove\", this._handleTouchMove);\r\n        this._canvas.addEventListener(\"touchend\", this._handleTouchEnd);\r\n    };\r\n\r\n    SignaturePad.prototype.on = function() {\r\n        this._handleMouseEvents();\r\n        this._handleTouchEvents();\r\n    };\r\n\r\n    SignaturePad.prototype.off = function() {\r\n        this._canvas.removeEventListener(\"mousedown\", this._handleMouseDown);\r\n        this._canvas.removeEventListener(\"mousemove\", this._handleMouseMove);\r\n        document.removeEventListener(\"mouseup\", this._handleMouseUp);\r\n\r\n        this._canvas.removeEventListener(\"touchstart\", this._handleTouchStart);\r\n        this._canvas.removeEventListener(\"touchmove\", this._handleTouchMove);\r\n        this._canvas.removeEventListener(\"touchend\", this._handleTouchEnd);\r\n    };\r\n\r\n    SignaturePad.prototype.isEmpty = function() {\r\n        return this._isEmpty;\r\n    };\r\n\r\n    SignaturePad.prototype._reset = function() {\r\n        this.points = [];\r\n        this._lastVelocity = 0;\r\n        this._lastWidth = (this.minWidth + this.maxWidth) \/ 2;\r\n        this._isEmpty = true;\r\n        this._ctx.fillStyle = this.penColor;\r\n    };\r\n\r\n    SignaturePad.prototype._createPoint = function(event) {\r\n        var rect = this._canvas.getBoundingClientRect();\r\n        return new Point(\r\n            event.clientX - rect.left,\r\n            event.clientY - rect.top\r\n        );\r\n    };\r\n\r\n    SignaturePad.prototype._addPoint = function(point) {\r\n        var points = this.points,\r\n            c2, c3,\r\n            curve, tmp;\r\n\r\n        points.push(point);\r\n\r\n        if (points.length &gt; 2) {\r\n            \/\/ To reduce the initial lag make it work with 3 points\r\n            \/\/ by copying the first point to the beginning.\r\n            if (points.length === 3) points.unshift(points[0]);\r\n\r\n            tmp = this._calculateCurveControlPoints(points[0], points[1], points[2]);\r\n            c2 = tmp.c2;\r\n            tmp = this._calculateCurveControlPoints(points[1], points[2], points[3]);\r\n            c3 = tmp.c1;\r\n            curve = new Bezier(points[1], c2, c3, points[2]);\r\n            this._addCurve(curve);\r\n\r\n            \/\/ Remove the first element from the list,\r\n            \/\/ so that we always have no more than 4 points in points array.\r\n            points.shift();\r\n        }\r\n    };\r\n\r\n    SignaturePad.prototype._calculateCurveControlPoints = function(s1, s2, s3) {\r\n        var dx1 = s1.x - s2.x,\r\n            dy1 = s1.y - s2.y,\r\n            dx2 = s2.x - s3.x,\r\n            dy2 = s2.y - s3.y,\r\n\r\n            m1 = {\r\n                x: (s1.x + s2.x) \/ 2.0,\r\n                y: (s1.y + s2.y) \/ 2.0\r\n            },\r\n            m2 = {\r\n                x: (s2.x + s3.x) \/ 2.0,\r\n                y: (s2.y + s3.y) \/ 2.0\r\n            },\r\n\r\n            l1 = Math.sqrt(1.0 * dx1 * dx1 + dy1 * dy1),\r\n            l2 = Math.sqrt(1.0 * dx2 * dx2 + dy2 * dy2),\r\n\r\n            dxm = (m1.x - m2.x),\r\n            dym = (m1.y - m2.y),\r\n\r\n            k = l2 \/ (l1 + l2),\r\n            cm = {\r\n                x: m2.x + dxm * k,\r\n                y: m2.y + dym * k\r\n            },\r\n\r\n            tx = s2.x - cm.x,\r\n            ty = s2.y - cm.y;\r\n\r\n        return {\r\n            c1: new Point(m1.x + tx, m1.y + ty),\r\n            c2: new Point(m2.x + tx, m2.y + ty)\r\n        };\r\n    };\r\n\r\n    SignaturePad.prototype._addCurve = function(curve) {\r\n        var startPoint = curve.startPoint,\r\n            endPoint = curve.endPoint,\r\n            velocity, newWidth;\r\n\r\n        velocity = endPoint.velocityFrom(startPoint);\r\n        velocity = this.velocityFilterWeight * velocity +\r\n            (1 - this.velocityFilterWeight) * this._lastVelocity;\r\n\r\n        newWidth = this._strokeWidth(velocity);\r\n        this._drawCurve(curve, this._lastWidth, newWidth);\r\n\r\n        this._lastVelocity = velocity;\r\n        this._lastWidth = newWidth;\r\n    };\r\n\r\n    SignaturePad.prototype._drawPoint = function(x, y, size) {\r\n        var ctx = this._ctx;\r\n\r\n        ctx.moveTo(x, y);\r\n        ctx.arc(x, y, size, 0, 2 * Math.PI, false);\r\n        this._isEmpty = false;\r\n    };\r\n\r\n    SignaturePad.prototype._drawMark = function(x, y, size) {\r\n        var ctx = this._ctx;\r\n\r\n        ctx.save();\r\n        ctx.moveTo(x, y);\r\n        ctx.arc(x, y, size, 0, 2 * Math.PI, false);\r\n        ctx.fillStyle = 'rgba(255, 0, 0, 0.2)';\r\n        ctx.fill();\r\n        ctx.restore();\r\n    };\r\n\r\n    SignaturePad.prototype._drawCurve = function(curve, startWidth, endWidth) {\r\n        var ctx = this._ctx,\r\n            widthDelta = endWidth - startWidth,\r\n            drawSteps, width, i, t, tt, ttt, u, uu, uuu, x, y;\r\n\r\n        drawSteps = Math.floor(curve.length());\r\n        ctx.beginPath();\r\n        for (i = 0; i &lt; drawSteps; i++) {\r\n            \/\/ Calculate the Bezier (x, y) coordinate for this step.\r\n            t = i \/ drawSteps;\r\n            tt = t * t;\r\n            ttt = tt * t;\r\n            u = 1 - t;\r\n            uu = u * u;\r\n            uuu = uu * u;\r\n\r\n            x = uuu * curve.startPoint.x;\r\n            x += 3 * uu * t * curve.control1.x;\r\n            x += 3 * u * tt * curve.control2.x;\r\n            x += ttt * curve.endPoint.x;\r\n\r\n            y = uuu * curve.startPoint.y;\r\n            y += 3 * uu * t * curve.control1.y;\r\n            y += 3 * u * tt * curve.control2.y;\r\n            y += ttt * curve.endPoint.y;\r\n\r\n            width = startWidth + ttt * widthDelta;\r\n            this._drawPoint(x, y, width);\r\n        }\r\n        ctx.closePath();\r\n        ctx.fill();\r\n    };\r\n\r\n    SignaturePad.prototype._strokeWidth = function(velocity) {\r\n        return Math.max(this.maxWidth \/ (velocity + 1), this.minWidth);\r\n    };\r\n\r\n    var Point = function(x, y, time) {\r\n        this.x = x;\r\n        this.y = y;\r\n        this.time = time || new Date().getTime();\r\n    };\r\n\r\n    Point.prototype.velocityFrom = function(start) {\r\n        return (this.time !== start.time) ? this.distanceTo(start) \/ (this.time - start.time) : 1;\r\n    };\r\n\r\n    Point.prototype.distanceTo = function(start) {\r\n        return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));\r\n    };\r\n\r\n    var Bezier = function(startPoint, control1, control2, endPoint) {\r\n        this.startPoint = startPoint;\r\n        this.control1 = control1;\r\n        this.control2 = control2;\r\n        this.endPoint = endPoint;\r\n    };\r\n\r\n    \/\/ Returns approximated length.\r\n    Bezier.prototype.length = function() {\r\n        var steps = 10,\r\n            length = 0,\r\n            i, t, cx, cy, px, py, xdiff, ydiff;\r\n\r\n        for (i = 0; i &lt;= steps; i++) {\r\n            t = i \/ steps;\r\n            cx = this._point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);\r\n            cy = this._point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);\r\n            if (i &gt; 0) {\r\n                xdiff = cx - px;\r\n                ydiff = cy - py;\r\n                length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);\r\n            }\r\n            px = cx;\r\n            py = cy;\r\n        }\r\n        return length;\r\n    };\r\n\r\n    Bezier.prototype._point = function(t, start, c1, c2, end) {\r\n        return start * (1.0 - t) * (1.0 - t) * (1.0 - t) +\r\n            3.0 * c1 * (1.0 - t) * (1.0 - t) * t +\r\n            3.0 * c2 * (1.0 - t) * t * t +\r\n            end * t * t * t;\r\n    };\r\n\r\n    return SignaturePad;\r\n})(document);\r\n\r\nvar signaturePad = new SignaturePad(document.getElementById('signature-pad'), {\r\n    backgroundColor: 'rgba(255, 255, 255, 0)',\r\n    penColor: 'rgb(0, 0, 0)',\r\n    velocityFilterWeight: .7,\r\n    minWidth: 0.5,\r\n    maxWidth: 2.5,\r\n    throttle: 16, \/\/ max x milli seconds on event update, OBS! this introduces lag for event update\r\n    minPointDistance: 3,\r\n});\r\nvar saveButton = document.getElementById('save'),\r\n    clearButton = document.getElementById('clear'),\r\n    showPointsToggle = document.getElementById('showPointsToggle');\r\n\r\nsaveButton.addEventListener('click', function(event) {\r\n    var data = signaturePad.toDataURL('image\/png');\r\n    window.open(data);\r\n});\r\nclearButton.addEventListener('click', function(event) {\r\n    signaturePad.clear();\r\n});\r\nshowPointsToggle.addEventListener('click', function(event) { \r\n    signaturePad.showPointsToggle();\r\n    showPointsToggle.classList.toggle('toggle');\r\n});<\/pre>\n<p>Customize the code further to fit your application&#8217;s needs. You can integrate the signature pad into your forms or document signing processes, ensuring a smooth and user-friendly experience for capturing signatures.<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created a Signature Pad using this JavaScript code. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code implements a Signature Pad that allows users to draw signatures using a mouse or touch input. It&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8746,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[56],"tags":[],"class_list":["post-8741","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-others"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Signature Pad Code with Example &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Signature Pad Code with Example &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-20T17:55:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T10:55:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"JavaScript Signature Pad Code with Example\",\"datePublished\":\"2024-01-20T17:55:00+00:00\",\"dateModified\":\"2024-01-22T10:55:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\"},\"wordCount\":271,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png\",\"articleSection\":[\"Others\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\",\"url\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\",\"name\":\"JavaScript Signature Pad Code with Example &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png\",\"datePublished\":\"2024-01-20T17:55:00+00:00\",\"dateModified\":\"2024-01-22T10:55:47+00:00\",\"description\":\"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png\",\"width\":1280,\"height\":960,\"caption\":\"JavaScript Signature Pad Code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Others\",\"item\":\"https:\/\/codehim.com\/category\/others\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Signature Pad Code with Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Signature Pad Code with Example &#8212; CodeHim","description":"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Signature Pad Code with Example &#8212; CodeHim","og_description":"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-20T17:55:00+00:00","article_modified_time":"2024-01-22T10:55:47+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"JavaScript Signature Pad Code with Example","datePublished":"2024-01-20T17:55:00+00:00","dateModified":"2024-01-22T10:55:47+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/"},"wordCount":271,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png","articleSection":["Others"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/","url":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/","name":"JavaScript Signature Pad Code with Example &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png","datePublished":"2024-01-20T17:55:00+00:00","dateModified":"2024-01-22T10:55:47+00:00","description":"Here is a free code snippet to create a JavaScript Signature Pad Code with Example. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/10\/JavaScript-Signature-Pad-Code.png","width":1280,"height":960,"caption":"JavaScript Signature Pad Code"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/others\/javascript-signature-pad-code-with-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Others","item":"https:\/\/codehim.com\/category\/others\/"},{"@type":"ListItem","position":3,"name":"JavaScript Signature Pad Code with Example"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":2387,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/8741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=8741"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/8741\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/8746"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=8741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=8741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=8741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}