如何在每个打印页面中腾出空间?

时间:2018-08-14 10:31:43

标签: javascript jquery html css

如何在每个打印页面之间留出空间。

我得到了什么”- enter image description here

我想要什么:- enter image description here

这是我的代码:-

 $('.printBtn').click(function () {
                var printContent = $('#entireForm').html();
                var WinPrint = window.open('', '', 'left=0,toolbar=0,scrollbars=0,status=0')
                WinPrint.resizeTo(screen.width, screen.height);
                WinPrint.document.write('<html><head><title>NorthStarDoc</title>')
                WinPrint.document.write('<style type="text/css">')
                WinPrint.document.write('body{ font-family: Arial !important;} @page{size:auto; margin:0px 10px;} *{ margin:0px; padding:0px;}p{margin:0px; padding:0px;}')
                WinPrint.document.write('</style>')
                WinPrint.document.write('<link href="~/Content/content/css/print.css" rel="stylesheet" media="print" />')
                WinPrint.document.write('</head><body>')
                WinPrint.document.write(printContent);
                WinPrint.document.write('</body><html>')
                WinPrint.focus();
                WinPrint.print();
                WinPrint.close();
                closePrintSign();
		});
*{ margin:0px; padding:0px;}
p{margin:0px; padding:0px;}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<div class="container" id="entireForm">
<h2>pritn form</h2>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p><p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<p>This is my print content</p>
<a href="#" class="printBtn btn btn-primary">Print</a>
</div>

这不是重复的问题,实际上我发现了类似的问题,但不完全相同。

0 个答案:

没有答案