title: write & open pdf file using jspdf library in phonegap
body: <p>I have gone through many blogs, i have success to create pdf file in phonegap but with no data.</p>
  
  <p>My Code
  javascrpit : </p>
  
  <pre><code>document.addEventListener("deviceready", createPDF, false);
  
  function createPDF(){
  var doc = new jsPDF();
  
  doc.text(20, 20, 'HELLO!');
  
  doc.setFont("courier");
  doc.setFontType("normal");
  doc.text(20, 30, 'This is a PDF document generated using JSPDF.');
  doc.text(20, 50, 'YES, Inside of PhoneGap!');
  
  //FIRST GENERATE THE PDF DOCUMENT
  console.log("generating pdf...");
  var doc = new jsPDF();
  
  doc.text(20, 20, 'HELLO!');
  
  doc.setFont("courier");
  doc.setFontType("normal");
  doc.text(20, 30, 'This is a PDF document generated using JSPDF.');
  doc.text(20, 50, 'YES, Inside of PhoneGap!');
  
  var pdfOutput = doc.output();
  console.log( pdfOutput );
  
  //NEXT SAVE IT TO THE DEVICE'S LOCAL FILE SYSTEM
  console.log("file system...");
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
  
     console.log("------------------------------------"+fileSystem.name);
     console.log("------------------------------------"+fileSystem.root.name);
     console.log("------------------------------------"+fileSystem.root.fullPath);
  
     fileSystem.root.getFile("test erp.pdf", {create: true}, function(entry) {
        var fileEntry = entry;
        console.log(entry);
  
        entry.createWriter(function(writer) {
           writer.onwrite = function(evt) {
           console.log("write success");
        };
  
        console.log("writing to file");
           writer.write( pdfOutput );
        }, function(error) {
           console.log(error);
        });
  
     }, function(error){
        console.log(error);
     });
  },
  function(event){
   console.log( evt.target.error.code );
  });
  }
  </code></pre>
  
  <p>and config.xml :</p>
  
  <pre><code>&lt;plugin name="LocalFileSystem" value="org.apache.cordova.file"/&gt;
  </code></pre>
  
  <p>and added only one javascrpit at the bottom of body</p>
  
  <pre><code>&lt;script src="js/html_to_pdf/jspdf.source.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>If you try this, Then there will be no error on console and new file will be created on phone memory but as empty file and you will not be able to open it as dialog will  comes "Document size is 0".</p>
  
  <p>Can anyone have any reference or solution on this.
  Waiting for valuable reply.</p>
  
  <p>Thanks in advanced.</p>