这是我动态生成的表格。要下载pdf。
它在google chrome
中运行正常。但是请点击firefox
中的服务。
$scope.downloadSettledReport = function () {
var template = " <html> <head> <style> div{font-size: 10px;}table, .center{margin: auto; width: 60%; padding: 10px;}</style> </head> <body class='center'> <table> <tr> <td>" + $scope.downloadContent[0].outerHTML + "</td></tr></table> </body></html>";
var element = $('<form/>');
element.html('<input type="text" name="fileHtml" value="' + encodeURI(template) + '"/> <input type="text" name="fileName" value="SettlementREport.pdf"/>');
element.attr({ method: 'POST', action: UtilitiesService.getUrlPrefix() + "/hosp/file/getPdf" }).submit();
}
答案 0 :(得分:0)
我只是将html模板附加到正文并开始工作。
$scope.downloadSettledReport = function () {
var template = " <html> <head> <style> div{font-size: 10px;}table, .center{margin: auto; width: 60%; padding: 10px;}</style> </head> <body class='center'> <table> <tr> <td>" + $scope.downloadContent[0].outerHTML + "</td></tr></table> </body></html>";
var element = $('<form/>');
element.html('<input type="text" name="fileHtml" value="' + encodeURI(template) + '"/> <input type="text" name="fileName" value="SettlementREport.pdf"/>');
element.attr({ method: 'POST', action: "action: UtilitiesService.getUrlPrefix() + "/hosp/file/getPdf"" });
$(document.body).append(element);
element.submit();
}