本文只介绍如何自动隐藏页眉和页脚
在浏览器打印中,浏览器会自动勾选打印页眉和页脚,只要几行代码即可去除,
打印二维码为demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>打印</title>
<!-- 去除页眉页脚 -->
<style media="print">
@page {
size: auto; /* auto is the initial value */
margin: 0mm; /* this affects the margin in the printer settings */
}
</style>
</head>
<body>
<div id="qrcode"></div>
<input type="button" id="print-btn" value="打印" onclick="toPrint()"/>
<script src="${rc.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${rc.contextPath}/js/sys/qrcode.min.js"></script>