-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
43 lines (39 loc) · 1.14 KB
/
index.js
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
$("#generateButton").click(function () {
genQrCode()
});
//var l = {}; location.search.slice(1).split("&").map(function(v){var x = v.split("="); l[x[0]] = x[1]; });
function genQrCode() {
var accName = $("#accName").val();
var accNumber = $("#accNumber").val();
var accIFSC = $("#accIFSC").val();
//TODO - Show Error on empty Box.
console.log(accName, accNumber, accIFSC);
var str = "upi://pay?pa=" + accNumber + "@" + accIFSC +".ifsc.npci&pn=" + accName + "&cu=INR";
$("#accNumberReplace").text(accNumber);
$("#accNameReplace").text(accName);
$("#accIFSCReplace").text(accIFSC);
$("#box1").html("");
var qrcode = new QRCode("box1", {
text: str,
width: 256,
height: 256,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
}
$("#DownloadQrImage").click(function () {
DownloadQrImage();
});
function DownloadQrImage() {
html2canvas($("#A4Page"), {
letterRendering: 1,
allowTaint : true,
onrendered: function (canvas) {
//document.body.appendChild(canvas)
canvas.toBlob(function (blob) {
saveAs(blob, "UPI_QR_Code.png");
});
}
});
}