title: Generate a pdf from html page by using jspdf in angularjs
body: <p>I am trying to generate pdf from HTML table using jspdf.In this case the pdf is generated but the format is not suitable to original.
  This is my code.
      
   html code is</p>
  
  <pre><code>&lt;div class="invoice" id="customers"&gt;
  &lt;table ng-repeat="aim in input" id="example"&gt;
      &lt;tr&gt;
          &lt;th class="inv-left"&gt;&lt;div align="left"&gt;&lt;img src="./images/logo.png" alt=""&gt;&lt;/div&gt;&lt;/th&gt;
      &lt;th class="inv-right"&gt;&lt;div align="right"&gt;&lt;br&gt;
          101 Convention Center&lt;br&gt;
          dr #700, Las Vegas, &lt;br&gt;
          NV - 89019
      &lt;/div&gt;&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr &gt;
          &lt;th&gt;&lt;div  cg-busy="{promise:viewPromise}" align="left"&gt;          
          &lt;b&gt;Invoiced to&lt;/b&gt;&lt;br&gt;            
          {{aim.user.username}}&lt;br&gt;
          {{aim.vendor.address}}
      &lt;/div&gt;&lt;/th&gt;
      &lt;th class="inv-right"&gt;
      &lt;div align="right"&gt;&lt;b&gt;INVOICE&lt;/b&gt;&lt;br&gt;
          Invoice ID: {{aim.invoiceId}}&lt;br&gt;
          Invoice Date: {{aim.invoiceDate.date| dateFormat | date:'MM-dd-yyyy'}}&lt;br&gt;
          Due Date: {{aim.dueDate.date| dateFormat | date:'MM-dd-yyyy'}}
      &lt;/div&gt;&lt;/th&gt;
      &lt;/tr&gt;
      &lt;div class="invoice-content clearfix"  cg-busy="{promise:viewPromise}" &gt;
          &lt;tr&gt;
              &lt;td class="inv-thours"&gt;Total Hours&lt;/td&gt;
              &lt;td align="center"&gt;{{aim.totalHours}}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="inv-rate"&gt;Rate&lt;/td&gt;  
              &lt;td align="center"&gt;{{aim.billRate}}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="inv-rate"&gt;Amount&lt;/td&gt;   
              &lt;td align="center"&gt;{{(aim.totalHours) * (aim.billRate)}}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;                               
              &lt;td class="inv-thours"&gt;totalExpenses&lt;/td&gt;    
              &lt;td align="center"&gt;{{aim.totalExpenses}}&lt;/td&gt;     
          &lt;/tr&gt;
          &lt;tr&gt;                               
              &lt;td class="inv-thours"&gt;Total Amount&lt;/td&gt;    
              &lt;td align="center"&gt;{{aim.amount}}&lt;/td&gt;  
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
              &lt;/td&gt;
              &lt;td ng-if="aim.status === 'UNCONFIRMED'"&gt;
                  &lt;div align="right" style="margin-right:10px;"&gt;&lt;input type="submit" value="Confirm"  data-ng-click="confirmStatus(aim)"&gt; | 
                      &lt;button onclick="goBack()"&gt;Cancel&lt;/button&gt;&lt;/div&gt;
              &lt;/td&gt;
              &lt;td ng-if="aim.status === 'CONFIRMED'"&gt;
                  &lt;div align="right" style="margin-right:10px;"&gt; 
                      &lt;button onclick="goBack()"&gt;BACK&lt;/button&gt;&lt;/div&gt;
              &lt;/td&gt;
              &lt;td ng-if="!(aim.status === 'UNCONFIRMED') &amp;&amp; !(aim.status === 'CONFIRMED')"&gt;
                  &lt;button onclick="javascript:demoFromHTML();"&gt;PDF&lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;script type="text/javascript" src="http://mrrio.github.io/jsPDF/dist/jspdf.debug.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  function demoFromHTML() {
      var pdf = new jsPDF('p', 'pt', 'letter');
      var imgData = '.............';
      pdf.setFontSize(40);
      pdf.addImage(imgData, 'PNG', 12, 30, 130, 40);
      pdf.cellInitialize();
      pdf.setFontSize(10);
      $.each($('#customers tr'), function (i, row) {
          $.each($(row).find("th"), function (j, cell) {
              var txt = $(cell).text();
              var width = (j == 4) ? 300 : 300; //make with column smaller
              pdf.cell(10, 30, width, 70, txt, i);
          });
          $.each($(row).find("td"), function (j, cell) {
              var txt = $(cell).text().trim() || " ";
              var width = (j == 4) ? 200 : 300; //make with column smaller
              pdf.cell(10, 50, width, 30, txt, i);
          });
  
      });
      pdf.save('sample-file.pdf');
  }
  </code></pre>
  
  <p>
  I whant to generate pdf to this formate
      <a href="http://i.stack.imgur.com/nrR7l.png" rel="nofollow">http://i.stack.imgur.com/nrR7l.png</a>
  but generate pdf formate is
      <a href="http://i.stack.imgur.com/DGSxE.png" rel="nofollow">http://i.stack.imgur.com/DGSxE.png</a>
  please help me to this problem.
  Thank you.</p>