title: how to export pdf with javascript
body: <p>my code index.blade.php</p>
  <pre><code> &lt;div class=&quot;content-body&quot;&gt;
                  &lt;div class=&quot;row&quot; id=&quot;basic-table&quot;&gt;
  
                      &lt;div class=&quot;col-md-12&quot;&gt;
                          &lt;div class=&quot;card&quot;&gt;
                              &lt;div class=&quot;card-header&quot;&gt;
                                          
                                      &lt;div id=&quot;hidden-element&quot; class=&quot;btn btn-outline-primary mr-1 float-right&quot;&gt;&lt;i class=&quot;fa fa-file-pdf&quot;&gt;&lt;/i&gt;Export PDF&lt;/div&gt;
  
                                  &lt;h4 class=&quot;card-title&quot; style=&quot;margin-bottom: 5px&quot;&gt;
                                      REPORT
                                  &lt;/h4&gt;
                            
  
                              &lt;/div&gt;
                              &lt;div class=&quot;card-content&quot;&gt;
  
                                  &lt;div class=&quot;card-body&quot;&gt;
                                      &lt;div class=&quot;table-responsive&quot;&gt;
                                          &lt;table class=&quot;table mb-0&quot;&gt;
                                              &lt;thead&gt;
                                                  &lt;tr&gt;
                                                      &lt;th&gt;NAME&lt;/th&gt;
                                                      &lt;th&gt;COMPANY&lt;/th&gt;
                                                      &lt;th&gt;LOCATION&lt;/th&gt;
                                                      &lt;th&gt;IN&lt;/th&gt;
                                                      &lt;th&gt;OUT&lt;/th&gt;
                                                      &lt;TH&gt;DESCRIPTION&lt;/TH&gt;
                                                      {{-- &lt;th&gt;STATUS&lt;/th&gt; --}}
                                                  &lt;/tr&gt;
                                              &lt;/thead&gt;
                                              &lt;tbody&gt;
                                                
                                                  @foreach ($absen as $data)
                                                      
                                                      &lt;tr&gt;
                                                          &lt;td&gt;{{ $data-&gt;name ?? '' }}&lt;/td&gt;
                                                          &lt;td&gt;{{ $data-&gt;alias ?? '' }}&lt;/td&gt;
                                                          &lt;td&gt;{{ $data-&gt;location_name ?? '' }}&lt;/td&gt;
                                                          &lt;td&gt;
                                                              &lt;span class=&quot;badge badge-success&quot;&gt;
                                                                  {{ Carbon\Carbon::parse($data-&gt;in_time)-&gt;format('H:i:s') }}
                                                              &lt;/span&gt;
                                                          &lt;/td&gt;
                                                          &lt;td&gt;
                                                              &lt;span class=&quot; @if ($data-&gt;out_time != null) badge badge-info @else  @endif&quot;&gt;
                                                                  @if ($data-&gt;out_time != null)
                                                                      {{ Carbon\Carbon::parse($data-&gt;out_time)-&gt;format('H:i:s') }}
                                                                  @else
                                                                      {{ '-' }}
                                                                  @endif
                                                              &lt;/span&gt;
                                                          &lt;/td&gt;
                                                          &lt;td&gt;{{ $is_late }}&lt;/td&gt;
                                                          {{-- &lt;td&gt;{{ $data-&gt;note ?? '-' }}&lt;/td&gt; --}}
                                                      &lt;/tr&gt;
                                                  @endforeach
  
                                               
                                              &lt;/tbody&gt;
                                          &lt;/table&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
  
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
  
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
  </code></pre>
  <p>I use new jsPDF but a href button can't be clicked or it doesn't work, is there any other javascript to make export to pdf.</p>
  <p>my code export my data pdf with javascript</p>
  <pre><code>       &lt;script&gt;
             var source = window.document.getElementsByTagName(&quot;body&quot;)[0];
             var specialElementHandlers = {
                 '#hidden-element': function (element, renderer) {
                     return true;
                 }
             };
             var doc = new jsPDF({
                 orientation: 'landscape'
             });
             doc.setFont(&quot;courier&quot;);
             doc.setFontType(&quot;normal&quot;);
             doc.setFontSize(24);
             doc.setTextColor(100);
             doc.fromHTML(elementHTML, 15, 15, {
                 'width': 170,
                 'elementHandlers': specialElementHandlers
             });
  
         &lt;/script&gt;
  
  </code></pre>
  <p>i want to export data to pdf using javascript in view laravel, my current way has not worked, is there any other way to solve it?</p>