使用kendo exportPDF将HTML表导出为多页PDF文件

时间:2017-07-06 12:28:10

标签: html kendo-ui

我正在尝试使用KendoPDF将动态形成的div元素导出为PDF。但是我设法导出PDF以获得更少的数据(例如,下面的附加内容),但如果表行超过500或1000,我没有下载PDF。相反,我收到一个名为“下载失败 - 网络错误”的错误

注意:我已经在使用更快的Internet连接。如果这在这里不起作用,它将无法在最终用户的机器上工作。

请建议/协助我找到解决此问题的方法。

<div id="divUserreport2" style="display:none">
        <div class="load_more_items">
            <button class="button_normal" title="Export as PDF" id="btnexport1" name="btnexport1" onclick="ExportPDF()">Export as PDF</button>
        </div>
        <div id="reportExport1" class="table_cfn">
            <table cellspacing="0" width="100%">
                <tbody>
                    <tr><td colspan="5"><img src="\..\Content\images\logo_login.png" height="100%" width="30%"></td></tr>
                    <tr style="font-size: 15px;font-weight: bold;color: #67afe9;align:center;"><td colspan="3">User Report</td><td colspan="2">Date : 7/6/2017</td></tr>
                    <tr><th>Company Name</th><th>Name</th><th>E-Mail ID</th><th>System Role</th><th>Status</th></tr>                        
                    <tr><td></td>
                    <tr><td>Trial1</td><td>Al al</td><td>wepetturuh-1564@yopmail.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td></td><td>asas asas</td><td>ippemegece-8412@yopmail.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>77_Trial1</td><td>1 2</td><td>a@r.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>67_Trial1</td><td>1 1</td><td>ram@ram.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>56_Trial1</td><td>7 2</td><td>r@ra.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>hh_Trial1</td><td>a a</td><td>bob@bob.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>22_Trial1</td><td>1 1</td><td>22@g.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>jj_Trial1</td><td>ii ii</td><td>ii@i.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>kk_Trial1</td><td>j j</td><td>jack@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>99_Trial1</td><td>post 20</td><td>post20daysss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>00_Trial1</td><td>post 5</td><td>post5daysss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>99_Trial2</td><td>today user</td><td>todayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>11_Trial1</td><td>1dayauthorss user</td><td>1dayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>00_Trial2</td><td>3dayauthorss user</td><td>3dayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>00_Trial3</td><td>5dayauthorss user</td><td>5dayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>ii_Trial1</td><td>8dayauthorss user</td><td>8dayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                    <tr><td>09_Trial1</td><td>12dayauthorss user</td><td>12dayauthorss@rhyta.com</td><td>Author</td><td>Active</td></tr>
                </tbody>
            </table>
        </div>
    </div>

以下是pdf导出函数调用:

setTimeout(function(){                         kendo.drawing.drawDOM($(“#reportExport1”),{                             paperSize:“A2”,                             multiPage:true,                             margin:{left:“0cm”,top:“1cm”,right:“0cm”,bottom:“1cm”}                         })                     //kendo.drawing.drawDOM($("#exportimage“))                     .then(function(group){                         //将结果渲染为PDF文件                         return kendo.drawing.exportPDF(group);                     })                     .done(function(data){                         //保存PDF文件                         kendo.saveAs({                             dataURI:数据,
                            fileName:'User Report.pdf',                             proxyURL:“/帐户/出口”                         });                         $( “预加载”)隐藏()。                     });                     },2000);

0 个答案:

没有答案