title: how to export html data to pdf in angularjs
body: <p>this is my html code where i rendered all <code>json</code> data from <code>.js</code> file but getting </p>
  
  <blockquote>
    <p>TypeError: Cannot convert undefined or null to object
        at Function.keys ()
        at DocMeasure.measureNode (pdfmake.js:15647)
        at DocMeasure.measureDocument (pdfmake.js:15635)
        at LayoutBuilder.tryLayoutDocument (pdfmake.js:15088)
        at LayoutBuilder.layoutDocument (pdfmake.js:15076)
        at PdfPrinter.createPdfKitDocument (pdfmake.js:2130)
        at Document._createDoc (pdfmake.js:82)
        at Document.getDataUrl (pdfmake.js:177)
        at Document.open (pdfmake.js:109)
        at l.$scope.openPdf (app.js:29)
        </p>
  </blockquote>
  
  <pre><code>&lt;head&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="pdfmake.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="vfs_fonts.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="app.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="jquery-3.1.1.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="raj.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="jspdf.js"&gt;&lt;/script&gt;
  
  
  
  &lt;/head&gt;
  
  &lt;body ng-app="pdfDemo"&gt;
    &lt;div ng-controller="pdfCtrl"&gt;
            &lt;div id="pdfContent"&gt;
                    &lt;table id="example-table"&gt;
                              &lt;thead&gt;
                              &lt;th&gt;firstName&lt;/th&gt;
                              &lt;th&gt;lastName&lt;/th&gt;
                              &lt;th&gt;Gender&lt;/th&gt;
                              &lt;th&gt;Mobile&lt;/th&gt;
  
                              &lt;/thead&gt;
                              &lt;tbody&gt;
                              &lt;tr ng-repeat="emp in employees"&gt;
                              &lt;td&gt;{{emp.firstName}}&lt;/td&gt;
                              &lt;td&gt;{{emp.lastName}}&lt;/td&gt;
                              &lt;td&gt;{{emp.gender}}&lt;/td&gt;
                              &lt;td&gt;{{emp.mobile}}&lt;/td&gt;
                              &lt;/tr&gt;
  
                              &lt;/tbody&gt;
  
                    &lt;/table&gt;
            &lt;/div&gt;
      &lt;button ng-click="openPdf()"&gt;Open Pdf&lt;/button&gt;
      &lt;button ng-click="downloadPdf()"&gt;Download Pdf&lt;/button&gt;
    &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>