title: Fixed number of rows per page using pdfmake.js
body: <p>Defined an own table layouts using pdfmake.js. On print I want per page to contain 7 rows(fixed).I have tried adjusting the height and width of the table cell to contain 7 rows but however if the data in table cell increases the page accumulates with less/more no.of rows. </p>
  
  <p>//layout of the table:</p>
  
  <pre><code>var tablelist={
        style: 'tableExample',
        table: {
            dontBreakRows: true,
             widths: [ 20,55,55,55,55,55,55,55,55,55,55,55,55],
            headerRows: 1,
            body: body
  
        },
        layout: {
          hLineWidth: function (i, node) {
            return (i === 0 || i === node.table.body.length) ? 1 : 1;
          },
          vLineWidth: function (i, node) {
            return (i === 0 || i === node.table.widths.length) ? 1: 1;
          },
          hLineColor: function (i, node) {
            return (i === 0 || i === node.table.body.length) ? 'gray' : 'gray';
          },
          vLineColor: function (i, node) {
            return (i === 0 || i === node.table.widths.length) ? 'gray' : 'gray';
          },
  
        },
  
      }
    return tablelist;
    }
  </code></pre>
  
  <p>//pushing the table header and other data to the table body</p>
  
  <pre><code>  $scope.makePrintTable = function(){
  
  var headers = {
      col_1:{ text: 'Day', style: 'tableHeader',rowSpan: 1, alignment: 'center',margin: [0, 8, 0, 0] },
      col_2:{ text: 'Date', style: 'tableHeader',rowSpan: 1, alignment: 'center',margin: [0, 8, 0, 0] },
      col_3:{ text: '0600-0800', style: 'tableHeader',rowSpan: 1, alignment: 'center',margin: [0, 8, 0, 0] },
      .
      .
      .//Similarly till col_13
        col_13:{ text: '1700-1800', style: 'tableHeader',rowSpan: 1, alignment: 'center' ,margin: [0, 8, 0, 0]},
  
      }
  
      body = [];
      var row = new Array();
  
      for (var key in headers) {
      row.push( headers[key] );   
        }
      body.push(row);
  
  
  for ( var j=0 ; j&lt; $scope.table.length; j++){
    var tableEach={ };
    tableEach= $scope.table[j];
  
    /*This for Genarating Object variables*/
    for (var i = 1; i &lt; 3; i++) { 
       window["obj"+i] = new Object();
    }
  
    var row = new Array();
    var slNoValue = tableEach.slNo;
  
    /*This is for slNo  */
    obj1["text"] = slNoValue;
    obj1["style"]= "cellswidth"; 
    row.push(obj1);
  
     /*This is for Date  */
    var dateValue = new Date(tableEach.date);
    obj2["text"]= dateValue.getDate() + '-' + basicFormats.getMonthName(dateValue.getMonth() )+ '-' + dateValue.getFullYear()+','+ basicFormats.getDayName(dateValue.getDay());
    obj2["style"]= "cellswidth";
    row.push(obj2);
  
    /*This is for remaining columns (i ranges from 6 to 17 (time in 24hrs clock format) )  */
   for(var i=6 ; i&lt;=17 ; i++){
     var obj={};
  
     var hourValue = "hour_"+i+"_"+(i+1)+"_value";
     var hourValueColor = "hour_"+i+"_"+(i+1)+"_"+"color_value";
  
        hourValue = ( tableEach["hour_"+i] == undefined ? '':(tableEach["hour_"+i]));
        hourValueColor =(tableEach["hour_"+i+"_colour"] == undefined ? '#ffffff':(tableEach["hour_"+i+"_colour"]));
        obj["text"] = hourValue;
        obj["fillColor"] = hourValueColor;
        obj["style"] = "cellswidth";
        row.push(obj);
        console.log(obj);
  
      }
    //  if( j!= 0 &amp;&amp; j % 7 == 0){
    //   pageBreak : 'before'
    //  }
   } 
    body.push(row); 
  </code></pre>
  
  <p>}</p>
  
  <p>};</p>
  
  <p>//CSS for tablecells</p>
  
  <pre><code>cellswidth  : {
          fontSize: 10,
          // color:'gray',
          bold: true,
          alignment: 'center',
          margin: [0, 12.55, 0, 12.75],
  
        },
  </code></pre>