title: Using jsPDF with Electron
body: <p>I'm trying to create generate a pdf document in my Electron application. When the user selects a JSON file I want to parse it and create the new PDF document. I'm getting a error when trying to create the document.</p>
  
  <h3>error</h3>
  
  <pre><code>Uncaught Error: Type of text must be string or Array. "undefined" is not recognized.
      at Object.H.text (/Users/antarrbyrd/dev/pathway_exporter/bower_components/jspdf/dist/jspdf.min.js:1)
      at HTMLInputElement.&lt;anonymous&gt; (index.html:48)
      at HTMLInputElement.dispatch (/Users/antarrbyrd/dev/pathway_exporter/lib/jquery.min.js:3)
      at HTMLInputElement.q.handle (/Users/antarrbyrd/dev/pathway_exporter/lib/jquery.min.js:3) 
  </code></pre>
  
  <h3>index.html</h3>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;link href="./bower_components/photon/dist/css/photon.min.css" rel="stylesheet" type="text/css" /&gt;
      &lt;title&gt;Seremedi - Pathway Exporter&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div class="window"&gt;
        &lt;header class="toolbar toolbar-header"&gt;
          &lt;div class="btn-group"&gt;
            &lt;button class="btn btn-large btn-default" id="open-button"&gt;
              &lt;span class="icon icon-folder"&gt;&lt;/span&gt;
            &lt;/button&gt;
            &lt;button class="active btn btn-large btn-default"&gt;
              &lt;span class="icon icon-download"&gt;&lt;/span&gt;
            &lt;/button&gt;
            &lt;button class="active btn btn-large btn-default"&gt;
              &lt;span class="icon icon-print"&gt;&lt;/span&gt;
            &lt;/button&gt;
          &lt;/div&gt;
          &lt;input type="file" id="file-input" style="display: none;"&gt;&lt;/input&gt;
        &lt;/header&gt;
        &lt;div class="window-content"&gt;
          &lt;webview id="webview" autosize style="display:inline-flex; width:100%; height:100%"&gt;&lt;/webview&gt;
        &lt;/div&gt;
        &lt;footer class="toolbar toolbar-footer"&gt;
          &lt;h1 class="title"&gt;&amp;copy; Seremedi - 2017&lt;/h1&gt;
        &lt;/footer&gt;
      &lt;/div&gt;
    &lt;/body&gt;
    &lt;script&gt;
      $ = require('jquery')
      jsPDF = require('jspdf')
      PDFDocument = require('pdfkit')
  
      $('#open-button').on('click',function(evt){
        evt.preventDefault();
        $('#file-input').click();
      });
      $('#file-input').on('change',function(evt){
        var location = $('#file-input')[0].files[0].path;
        source = "";
        $('#webview').prop('src', location);
        $.getJSON(location, function(json){
          source = json;
          console.log(source);
        });
        var doc = new jsPDF();
        doc.text(source.ReferenceId, 10, 10);
        doc.save('file.pdf');
      });
    &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>