my code index.blade.php
<div class="content-body">
<div class="row" id="basic-table">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<div id="hidden-element" class="btn btn-outline-primary mr-1 float-right"><i class="fa fa-file-pdf"></i>Export PDF</div>
<h4 class="card-title" style="margin-bottom: 5px">
REPORT
</h4>
</div>
<div class="card-content">
<div class="card-body">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>NAME</th>
<th>COMPANY</th>
<th>LOCATION</th>
<th>IN</th>
<th>OUT</th>
<TH>DESCRIPTION</TH>
{{-- <th>STATUS</th> --}}
</tr>
</thead>
<tbody>
@foreach ($absen as $data)
<tr>
<td>{{ $data->name ?? '' }}</td>
<td>{{ $data->alias ?? '' }}</td>
<td>{{ $data->location_name ?? '' }}</td>
<td>
<span class="badge badge-success">
{{ Carbon\Carbon::parse($data->in_time)->format('H:i:s') }}
</span>
</td>
<td>
<span class=" @if ($data->out_time != null) badge badge-info @else @endif">
@if ($data->out_time != null)
{{ Carbon\Carbon::parse($data->out_time)->format('H:i:s') }}
@else
{{ '-' }}
@endif
</span>
</td>
<td>{{ $is_late }}</td>
{{-- <td>{{ $data->note ?? '-' }}</td> --}}
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
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.
my code export my data pdf with javascript
<script>
var source = window.document.getElementsByTagName("body")[0];
var specialElementHandlers = {
'#hidden-element': function (element, renderer) {
return true;
}
};
var doc = new jsPDF({
orientation: 'landscape'
});
doc.setFont("courier");
doc.setFontType("normal");
doc.setFontSize(24);
doc.setTextColor(100);
doc.fromHTML(elementHTML, 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
</script>
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?