从html打印到pdf时添加水印

时间:2018-07-14 12:05:07

标签: javascript html angularjs

在下面的代码中,我想在从HTML打印到pdf的每页中添加水印:

$scope.printTableFunc = function (divName) {      
    var printContents = document.getElementById(divName).innerHTML;  
    console.log(printContents)         
    var popupWin = window.open('', '_blank','width=1080,height=960');  
    popupWin.document.open();     
    popupWin.document.write(`
       <html>
         <head >
           <link rel="stylesheet" type="text/css" href="../res/css/style.css" />
         </head>
         <body onload="window.print()">${printContents}
         </body>
       </html>
    `);    
    popupWin.document.close();     
} 

0 个答案:

没有答案