使用打印插件说明:

/*

* printThis v1.15.1

* @desc Printing plug-in for jQuery

* @author Jason Day

*

*/

print.css  文件内容

@page

{

size: auto; /* auto is the initial value */

margin: 0mm 10mm 0mm 10mm; /* this affects the margin in the printer settings 最关键的还是这个*/

}

body

{

background-color:#FFFFFF;

margin: 0mm; /* this affects the margin on the content before sending to printer */

padding: 5mm 0 5mm 0 ;

}

修改打印插件源码

第190 行处,改为: $head.append("");

页面调用程序

$('#basic').on("click", function () {

$('.demo').printThis({

loadCSS: "css/print.css"

});

});

$('#advanced').on("click", function () {

$('#impAndContent').printThis({

importCSS: true, // import parent page css

importStyle: false, // import style tags

printContainer: true, // grab outer container as well as the contents of the selector

loadCSS: "css/print.css", // path to additional css file - use an array [] for multiple

header: "

Look at all of my kitties!

"

});

});

实现效果如图:

;

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐