
Uncaught ReferenceError
Publicado por anonymous (1 intervención) el 08/05/2017 12:40:21
Hola, tengo el siguiente código:
pero me da dos errores, uno al pre visualizar y otro al descargar, lo que no entiendo es que antes me iba bien y hoy ya no.
Bueno los errores son:
Uncaught TypeError: Cannot read property 'toDataURL' of undefined
at HTMLAnchorElement.<anonymous> (va.html:933)
at HTMLAnchorElement.dispatch (jquery.min.js:3)
at HTMLAnchorElement.r.handle (jquery.min.js:3)
va.html:924 Uncaught ReferenceError: html2canvas is not defined
at HTMLInputElement.<anonymous> (va.html:924)
at HTMLInputElement.dispatch (jquery.min.js:3)
at HTMLInputElement.r.handle (jquery.min.js:3)
¿Alguien sabe como solucionarlo?
Gracias
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
<script>
$(document).ready(function(){
var element = $("#html-content-holder");
var getCanvas;
$("#btn-Preview-Image").on('click', function () {
html2canvas(element, {
onrendered: function (canvas) {
$("#previewImage").append(canvas);
getCanvas = canvas;
}
});
});
$("#btn-Convert-Html2Image").on('click', function () {
var imgageData = getCanvas.toDataURL("image/png");
var newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream");
$("#btn-Convert-Html2Image").attr("download", "your_pic_name.png").attr("href", newData);
});
});
</script>
Bueno los errores son:
Uncaught TypeError: Cannot read property 'toDataURL' of undefined
at HTMLAnchorElement.<anonymous> (va.html:933)
at HTMLAnchorElement.dispatch (jquery.min.js:3)
at HTMLAnchorElement.r.handle (jquery.min.js:3)
va.html:924 Uncaught ReferenceError: html2canvas is not defined
at HTMLInputElement.<anonymous> (va.html:924)
at HTMLInputElement.dispatch (jquery.min.js:3)
at HTMLInputElement.r.handle (jquery.min.js:3)
¿Alguien sabe como solucionarlo?
Gracias
Valora esta pregunta


0