ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
创建一个 appPrinterPop.js 文件,把 ``` (function () { appModule.factory('appPrinterPop', ['$window','$location', function ($window, $location) { var _appPrinter = {}; _appPrinter.print = function (nPrintHtml) { var nHtml = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'> " + "<meta http-equiv='Expires' content='0'>" + "<meta http-equiv='Pragma' content='no-cache'>" + "<meta http-equiv='Cache-control' content='no-cache'>" + "<meta http-equiv='Cache' content='no-cache'>" + "<style type=\"text/css\">{TEMPLATE_HEAD}</style></head><body >{TEMPLATE_BODY}</body></html>"; var nHtmlHead = "body {" + "background-color:white;"; nHtmlHead += "}" + ".panel-bill-print {" + "background-color: white;" + "margin: 15px;" + "}" + "table {" + "border-collapse: collapse;" + "border-color: #000000;" + "}" + "td {" + "border: solid 1px;" + "border-color: #000000;" + "font-size: 12px;" + "height: 22pt;" + "padding: 1px 2px 1px 2px;" + "nowrap: nowrap;" + "text-wrap: none;" + "valign: 'middle';" + "padding-left: 3px;" + "}" + "p {" + "page-break-after: always;" + "}" + ".row-header {" + "font-weight: 700;" + "}" + ".cell-header {" + "font-weight: 500;" + "}" + ".page-section {" + "margin-top: 5px;" + "margin-bottom: 5px;" + "text-align: left;" + "}" + ".page-title {" + "margin-top: 5px;" + "margin-bottom: 5px;" + "text-align: center;" + +"}" + ".barcode {" + "margin: 3px;" + "}" + ".printArea {" + "background - color: white;" + "color: black;" + "} "; nHtml = nHtml.replace('{TEMPLATE_HEAD}', nHtmlHead); nHtml = nHtml.replace('{TEMPLATE_BODY}', nPrintHtml); var iframe = document.createElement('iframe'); iframe.name = 'ifr'; iframe.id = "ifr"; iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'); document.body.appendChild(iframe); var doc = iframe.contentWindow.document; doc.open(); doc.write(nHtml); doc.close(); iframe.contentWindow.focus(); iframe.contentWindow.print(); document.body.removeChild(document.getElementById('ifr')); }; return _appPrinter; } ]); })(); ```