Ayuda amigos me genera este error:
Estoy haciendo un generador de php y lo tengo de esta manera pero no me funciona
ts del componente
convertJsonToPdf(){
var elem = document.getElementById("generate");
var doc = new jsPDF ('1', 'pt', 'letter');
var elem = document.getElementById("table");
var data = doc.autoTableHtmlToJson(elem);
var positions = [];
doc.autoTable(data.columns, data.rows);
doc.save("table.pdf");
}
html del componente
<button
type="button"
class="botonclic2 btn btn-outline-info"
(click)="convertJsonToPdf()">
Generar PDF
</button>
Me guie de esto:
Hello, try it.
To work with jspdf-autotable in angular 5, one must install jspdf and jspdf-autotable via npm
npm install jspdf-autotable --save
also add the jspdf and jspdf-autotable files to the scripts array in angular-cli.json
"scripts": [ "../node_modules/jspdf/dist/jspdf.min.js", "../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js" ],
and in component never import jspdf or jspdf-autotable just
declare var jsPDF: any;
Of course before working with jspdf-autotable one should install
jspdf
and for development@types/jspdf
vianpm
npm install jspdf --save npm install @types/jspdf --save-dev