const generatePDF = () => {
/*******/
//detail info
console.log(state.displayData_detail);
/******/
var doc = new jsPDF('p', 'px', 'letter');
doc.text(20, 20, '****')
doc.text('Reporte Inventario Fisico', 20, 35); //string, x-position, y-position
doc.text(state.displayData_head.NowDate, 300, 35); //string, x-position, y-position
doc.text(state.displayData_head.WarehouseDestName, 300, 45);
doc.text(state.displayData_head.WarehouseName, 300, 55);
//doc.text(state.displayData_head.WarehouseId, 100, 50); //string, x-position, y-position
doc.setFont('helvetica')
doc.text(20, 60, 'This is the second title OwO.')
var columns = ["PartnerId", "Descripcion", "Unidades", "CDU", "Importe"];
var rows = [];
var rows1 = [];
var itemNew =
/*
{ PartnerId:'1',ProductNum: 'Case Number', name : '101111111' },
{ PartnerId:'2',ProductNum: 'Patient Name', name : 'UAT DR' },
{ PartnerId:'3',ProductNum: 'Hospital Name', name: 'Dr Abcd' }
*/
state.displayData_detail
;
itemNew.forEach(element => {
var temp = [element.PartnerId,element.ProductNum];
var temp1 = [element.PartnerId,element.ProductNum];
rows.push(temp);
rows1.push(temp1);
});
doc.autoTable(columns,rows,
{ margin:{ top: 75 }}
);
doc.save('demo.pdf')
/******/
/******/
}
https://www.codegrepper.com/code-examples/javascript/jspdf+create+table
No hay comentarios:
Publicar un comentario