title: jsPDF convert html to pdf
body: <p>I'm trying convert HTML to PDF and I working in ASP.NET MVC5 here is my code : <br/></p>
  
  <pre><code>    @model Ebok.Models.AtmClaimReportDetailsInfoViewModel
  
  @{
      ViewBag.Title = "Dzienny raport rozliczenia transakcji bankomatu "+Model.AtmPid+" sieci "+Model.CustomerNumber;
  }
  &lt;div style="border-width: 2px; padding: 1em; font-size:120%;line-height: 1.5em;" id="fromHTMLtestdiv"&gt; // `&lt;-- THIS DIV NOT WORK`
  
      &lt;h3 class="text-align-center "&gt;Dzienny raport rozliczenia transakcji bankomatu @Model.AtmPid sieci @Model.CustomerNumber&lt;/h3&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="text-align-center col-xs-5"&gt;
  
              &lt;div class="text-align-center padding-top-10"&gt;
                  @Model.CompanyNameString
  
                  &lt;br /&gt;
                  NIP: @Model.Nip
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="text-align-center col-xs-5"&gt;
              Rozliczenie bankomatu @Model.AtmPid sieci @Model.CustomerNumber
              za dzień: @Model.BusinessDate.ToShortDateString() &lt;br /&gt;
              Wygenerowano dnia: @Model.CreationDate.ToShortDateString()
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  
          &lt;table class="table table-bordered"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt; Sieć&lt;/th&gt;
                      &lt;th&gt; ATM&lt;/th&gt;
                      &lt;th&gt; Adres&lt;/th&gt;
                      &lt;th&gt; Kwota korekty (uznanie)&lt;/th&gt;
                      &lt;th&gt; Kwota transakcji&lt;/th&gt;
                      &lt;th&gt; Data i godzina transakcji&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  @Html.Partial("ClaimReportsDetailsPartial")
              &lt;/tbody&gt;
          &lt;/table&gt;
  
      &lt;button onclick="javascript:demoFromHTML()" class="button"&gt;Run Code&lt;/button&gt;
  
      &lt;div id="fromHTMLtestdiv"&gt;  // **THIS DIV WORK FINE**
          &lt;h1&gt;
              We support special element handlers. Register them with jQuery-style.
              &lt;a&gt;asdsdsd&lt;/a&gt;
          &lt;/h1&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-actions"&gt;
      &lt;button class="print-link btn btn-info" onclick="jQuery.print('#printClaimReport')"&gt;&lt;i class="glyphicon glyphicon-print"&gt;&lt;/i&gt;&lt;/button&gt;
  
      &lt;input type="button" value="Powrót" onclick="location.href='@Url.Action("Index")'" class="btn btn-info" /&gt;
  &lt;/div&gt;
  
  @section Scripts {
  
  &lt;script type='text/javascript'&gt;
      function demoFromHTML() {
          var pdf = new jsPDF('p', 'pt', 'letter')
  
          // source can be HTML-formatted string, or a reference
          // to an actual DOM element from which the text will be scraped.
          , source = $('#fromHTMLtestdiv')[0]
  
          // we support special element handlers. Register them with jQuery-style 
          // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
          // There is no support for any other type of selectors 
          // (class, of compound) at this time.
          , specialElementHandlers = {
              // element with id of "bypass" - jQuery style selector
              '#bypassme': function (element, renderer) {
                  // true = "handled elsewhere, bypass text extraction"
                  return true
              }
          }
  
          margins = {
              top: 80,
              bottom: 60,
              left: 40,
              width: 522
          };
          // all coords and widths are in jsPDF instance's declared units
          // 'inches' in this case
          pdf.fromHTML(
             source // HTML string or DOM elem ref.
             , margins.left // x coord
             , margins.top // y coord
             , {
                 'width': margins.width // max width of content on PDF
                 , 'elementHandlers': specialElementHandlers
             },
             function (dispose) {
                 // dispose: object with X, Y of the last line add to the PDF 
                 //          this allow the insertion of new lines after html
                 pdf.save('Test.pdf');
             },
             margins
         )
          pdf.output('dataurl');
      }
  
  
  &lt;/script&gt;
  
  }
  </code></pre>
  
  <p>When using the first div I receives a message</p>
  
  <pre><code>TypeError: renderer.pdf.table is not a function
  </code></pre>
  
  <p>, but the second div work fine. </p>
  
  <p>Does anyone have any idea?</p>