After my jsPDF is working now, I have the same problem with autoTable.
my header.php:
<head>
.....
</head>
<header>
.....
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.0.0/jspdf.umd.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.6/jspdf.plugin.autotable.min.js"></script>
</header>
I require the header.php in other.php and want to use jsPDF in this file:
require "header.php";
<body>
....
</body>
<script>
window.jsPDF = window.jspdf.jsPDF;
function createInvoice(final){
const doc = new jsPDF();
console.log(window.autotable);
doc.text("Hello world!", 10, 10);
doc.autoTable({
head: [['Name', 'Email', 'Country']],
body: [
['David', 'david@example.com', 'Sweden'],
['Castille', 'castille@example.com', 'Spain']
]
});
doc.save("a4.pdf");
}
</script>
I tried different src, download it, but every time I am getting the following error :
doc.autoTable is not a function
Can someone help me? Thank you in advance