在angularjs / javascript中将html表下载到pdf中

时间:2017-01-24 11:57:20

标签: javascript jquery html angularjs pdf

我有一个html格式的表格,看起来像这样

<table id="table" class="table table-bordered font" style="width: 100%; padding-top: 10px;">
                    <thead>
                        <tr class="bg-primary textalign">
                            <th>Details</th>
                            <th>SonVin Id</th>
                            <th>Date</th>
                            <th>Venue Name</th>
                            <th>City</th>
                            <th>Area</th>
                            <th>Amount</th>
                            <th>
                                <input type="checkbox" ng-click="allcheck()" ng-model="checkall" /><span style="margin-left: 10px;">Add Invoice</span>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="fdata in getdataintable">
                            <td><a href="#" class="btn btn-success" ng-click="btndetails(fdata)" style="cursor: pointer" data-toggle="modal" data-target="#myModal">Details</a></td>
                            <td>{{fdata.sonvinid}}</td>
                            <td>{{fdata.date}}</td>
                            <td>{{fdata.venuename}}</td>
                            <td>{{fdata.location}}</td>
                            <td>{{fdata.area}}</td>
                            <td>{{fdata.amount}}</td>
                            <td>
                                <input type="checkbox" ng-checked="checkall" ng-model="fdata.checked" data-ng-click="calculateTotal(fdata)" /></td>
                        </tr>
                    </tbody>

                    <tbody>
                        <tr ng-repeat="totaldata in getdataintr">
                            <td colspan="6"></td>
                            <td>Total Amount</td>
                            <td>{{totaldata.amount}}</td>
                        </tr>
                    </tbody>
                </table>

我通过angularJS

将数据输入此表

我想让用户选择在angulajs

按钮点击下将此表格下载为pdf格式

这是包含下载按钮的div,然后返回

 <div style="margin-top:50px; margin-left:30vh;">
                    <a href="#" class="btn btn-success active">Save And Download PDF</a>
                    <a href="#" class="btn btn-danger active">Don't Save And Select Again</a>
                </div>

我没有创建任何将数据下载到pdf

的功能

当用户点击<a href="#" class="btn btn-success active">Save And Download PDF</a>此按钮时,该表格应下载到pdf

我需要做什么?

0 个答案:

没有答案