Pit - LODOP, Print Preview

Combined layui.
Content style pop-up box as follows: red box says about padding.

Figure I

 

 



Print preview styles are as follows: red box says about padding.

Figure II

 

 

 

 Figure II according to the left and right margins, to modify the left and right margins of a FIG. Or it will affect the body content of highly judgment.

Lodop custom print function package, you can use:

function print() {
    //引入LodopFuncs.js 为前提
    let LODOP = getLodop();

    $.get('../css/custom.css', function(res) { 
         let style = `<link href="../css文件路径" rel="stylesheet" />`   //可多个 
         let html = $('#所需要打印的父div').innerHTML;
         
         //如有需要,可以进行高度判断,进行分页
         let htmlHeight = $('#所需要打印的父div').outerHeight(true);


         //拼接 style 和 html
         let strFormHtml = `${style}<body> ${html} </body>`

         // 调用自带的api
         LODOP.ADD_PRINT_HTM(60, 0, "100%", "90%", strFormHtml);
  }
}  

  

Guess you like

Origin www.cnblogs.com/dbdb-123/p/11935459.html