title: how to convert html <div> to pdf
body: <pre><code>&lt;div id="content"&gt;
   &lt;h3&gt;Hello&lt;/h3&gt;
       &lt;table id = "tblHeader" &gt;
          &lt;tbody&gt;
             &lt;tr&gt;
               &lt;td width="10%"&gt;name&lt;/td&gt;                      
               &lt;td width="15%"&gt;id&lt;/td&gt;
               &lt;td width="27%"&gt;Patient Name &lt;/td&gt;
               &lt;td width="8%"&gt;Age&lt;/td&gt;
            &lt;/tr&gt;
         &lt;/tbody&gt;                
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;button id="cmd"&gt;generate PDF&lt;/button&gt;
  </code></pre>
  
  <p>This table I need to convert to pdf.</p>
  
  <p>I tried with jspdf and the function noted below.</p>
  
  <pre><code>$(function () {
  $('#cmd').click(function () {
      var pdf = new jsPDF('p', 'pt', 'letter'),
      source = $('#tblHeader')[0],
      margins = {
          top: 40,
          bottom: 40,
          left: 40,
          right: 40,
          width: 522
      };
  
      pdf.fromHTML(
          source,
          margins.left,
          margins.top,
          {
          'width': margins.width 
          },
          function (dispose) {
              pdf.save('Test.pdf');
          },
          margins
     );
  });
  });
  </code></pre>
  
  <p>And it generated pdf with column data as rows.Please help me.</p>