-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQRMaker.html
196 lines (153 loc) · 6.37 KB
/
QRMaker.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QRMaker</title>
<link rel="stylesheet" href="/css/qr.css">
<link rel="stylesheet" href="/DisenioWeb/css/qr.css">
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<script defer src="/js/qr.js"></script>
<script defer src="/DisenioWeb/js/qr.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"
integrity="sha512-qZvrmS2ekKPF2mSznTQsxqPgnpkI4DNTlrdUmTzrDgektczlKNRRhy5X5AAOnx5S09ydFYWWNSfcEqDTTHgtNA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"
integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="sweetalert2.min.js"></script>
<link rel="stylesheet" href="sweetalert2.min.css">
</head>
<body>
<!-- Button's template -->
<template id="my-template">
<swal-title>
Deseas descargar el código QR?
</swal-title>
<swal-icon type="warning" color="red"></swal-icon>
<swal-button type="confirm">
<a id="btnToPDF" onclick="downloadPNG('contenedorQR', prompt('Coloque el nombre de su archivo'))">Download
as
PNG</a>
</swal-button>
<swal-button type="cancel">
Cancelar
</swal-button>
<!-- <swal-button type="deny">
<a onclick="Convert_HTML_To_PDF()">Download
as
PDF</a>
</swal-button> -->
<swal-param name="allowEscapeKey" value="false" />
<swal-param name="customClass" value='{ "popup": "my-popup" }' />
<swal-function-param name="didOpen" value="popup => console.log(popup)" />
</template>
<div class="body">
<div class="contenedor">
<h1>QR Generator</h1>
<form action="" id="formulario" class="formulario">
<input style="display: flex; justify-content: center;" type="text" name="" id="link"
placeholder="Escribe el texto o URL">
<br>
<button class="btn">Generate QR</button>
</form>
<div>
<div class="contenedorQR" id="contenedorQR">
</div>
</div>
<button data-swal-toast-template="#my-template" class="btn">
Download
</button>
<div class="message">
<h2>I hope you enjoy this, feel free to share the link! or make a QR and share it!</h2>
</div>
<footer>
<!-- Firmita -->
<div padding-bottom: 20px;">
<address style="text-align: center;">
<a href="https://cpetruzzo.github.io/DisenioWeb" style="text-decoration: none;">
©CPetruzzo
</a>
</address>
</div>
</footer>
</div>
<!-- <div>
<button onclick="window.print()">Print this page</button>
</div> -->
<!-- <div id="invisible" style="display: none;">
<div id="contentToPrint">
<div class="contenedorQR2" id="contenedorQR2"></div>
</div>
</div>
</div> -->
<!-- Para la Municipalidad de Paraná -->
<div id="invisible" style="display: none;">
<div id="contentToPrint">
<img class="LogoPna" src="https://cpetruzzo.github.io/DisenioWeb/images/Factibilidad.png" alt="LogoPna"
srcset="">
<div class="contenedorQR2" id="contenedorQR2">
</div>
</div>
</div>
</div>
<!-- Download as PNG function -->
<script>
function downloadPNG(png, filename = '') {
var downloadLink;
var dataType = 'image/png';
var pngSelect = document.getElementById(png);
var pngHTML = pngSelect.lastChild.src;
// Specify file name
filename = filename ? filename + '.png' : 'miQR1.png';
// Create download link element
downloadLink = document.createElement("a");
document.body.appendChild(downloadLink);
if (navigator.msSaveOrOpenBlob) {
var blob = new Blob(['ufeff', pngHTML], {
type: dataType
});
navigator.msSaveOrOpenBlob(blob, filename);
} else {
// Create a link to the file
downloadLink.href = pngHTML;
console.log(downloadLink.href)
// Setting the file name
downloadLink.download = filename;
//triggering the function
downloadLink.click();
}
}
//////////////////////////////////////////////////////////////////
// window.jsPDF = window.jspdf.jsPDF;
// // Convert HTML content to PDF
// function Convert_HTML_To_PDF() {
// var doc = new jsPDF();
// // Source HTMLElement or a string containing HTML.
// var elementHTML = document.querySelector("#contentToPrint");
// doc.html(elementHTML, {
// callback: function (doc) {
// // Save the PDF
// doc.save('QRcode.pdf');
// },
// margin: [0, 0, 0, 0],
// autoPaging: 'text',
// x: 0,
// y: 0,
// width: 190, //target width in the PDF document
// height: 150,
// windowWidth: 675 //window width in CSS pixels
// });
// }
// </script>
<!-- Fancy button modals -->
<script>
Swal.bindClickHandler()
Swal.mixin({
toast: true,
}).bindClickHandler('data-swal-toast-template')
</script>
</body>
</html>