I need to create a function that turns webpages into a pdf file, then download it after a click function.
My function is
$('<script src="/webroot/help/jspdf.min.js"></script>').appendTo('head');
$('<script src="/webroot/help/html2pdf.js"></script>').appendTo('head');
var jsPDF = window.jspdf.jsPDF;
var pdf = new jsPDF('1','pt','a4');
pdf.canvas.height=72*11;
pdf.canvas.width = 72*8.5;
html2pdf($("div[widgetname=DC]"),pdf,function(pdf){
pdf.save('file.pdf');
});
I checked no downloads nor errors msg.