Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jspdf create table

convert() {

       var doc = new jsPDF();
       var col = ["Sr. No.","Details"];
       var col1 = ["Details", "Values"];
       var rows = [];
       var rows1 = [];

  /* The following array of object as response from the API req  */



var itemNew = [

  { index:'1',id: 'Case Number', name : '101111111' },
  { index:'2',id: 'Patient Name', name : 'UAT DR' },
  { index:'3',id: 'Hospital Name', name: 'Dr Abcd' }

]


   itemNew.forEach(element => {      
        var temp = [element.index,element.id];
        var temp1 = [element.id,element.name];
        rows.push(temp);
        rows1.push(temp1);

    });        

        doc.autoTable(col, rows, { startY: 10 });

        doc.autoTable(col1, rows1, { startY: 60 });
        doc.save('Test.pdf');
      }
Comment

PREVIOUS NEXT
Code Example
Javascript :: TypeError: JSON.stringify(...).then is not a function 
Javascript :: javascript get page args 
Javascript :: setAttribute is not a function jquery 
Javascript :: axios api post request 
Javascript :: nodejs watermark image 
Javascript :: faker js 
Javascript :: js hover event 
Javascript :: what is redis used for 
Javascript :: some method in js 
Javascript :: firebase signout 
Javascript :: how to import json in js 
Javascript :: array concat in javascript 
Javascript :: react native create text file 
Javascript :: vscode react extensions 
Javascript :: JS clickable checkbox 
Javascript :: how to serve css files express 
Javascript :: client.on ready 
Javascript :: right shift operator js 
Javascript :: creating a module with lazy loading in angular 9 
Javascript :: hex string to decimal string javascript 
Javascript :: Get size of a View in React Native 
Javascript :: next js react image upload 
Javascript :: split string every nth characters javascript 
Javascript :: how to run and clone react app 
Javascript :: sublime javascript autocomplete 
Javascript :: set cors for a react node application socket error 
Javascript :: jquery on change on multiple elements 
Javascript :: string match 
Javascript :: react pass props to children 
Javascript :: get duplicate value javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =