title: Page number on pdfmake javascript docdefinition
body: <p>I am looking forward to insert page number on footer using pdfmake. Although, using the example code is not working:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var docDefinition = {
    footer: function(currentPage, pageCount) { return currentPage.toString() + ' of ' + pageCount; },
    header: function(currentPage, pageCount, pageSize) {
      // you can apply any logic and return any valid pdfmake element
  
      return [
        { text: 'simple text', alignment: (currentPage % 2) ? 'left' : 'right' },
        { canvas: [ { type: 'rect', x: 170, y: 32, w: pageSize.width - 170, h: 40 } ] }
      ]
    },
    (...)
  };</code></pre>
  </div>
  </div>
  </p>
  <p>I have not insertend anything else in the code besides the above. Can someone help me? I am using angular.</p>