Select Print content in a page due to the project needs.
Pick up what you want to print with a DIV layer. For example:
The code copy is as follows:
<!-- Notice of transfer of petition matters Start -->
<div id="itemVrbjForm" style="font-family:'Song Song','Song style';font-size: 18px; margin-top: 290px;" >
<div>
<div style="float: right;margin-top: -40px;"> (information number: ${zjxfItemUser.acceptedNo })</div>
<div id="title" style="margin-top: 40px;" ><span>Notice on transfer of petition matters</span></div>
${zjxfItemUser.userName}: (name of the petitioner)<br/>
<span id="itemVrbjTime"></span>, this agency (or unit) has accepted the ${zjxfItemUser.subject} petition matters proposed by you (or you) in accordance with the law,
The petition matter is within the scope of XXX's authority. According to the relevant provisions of the "Letters and Petition Regulations", this agency has handed over the relevant materials to XXX on XXXX on XX, XXX, for processing. Please contact him in time. <br/>
Let me know hereby. <br />
<div style="margin-top:50px;margin-right: 20px;float: right;"> (Sub-sub-name } special seal or official seal)</div>
<div style="margin-top:90px;margin-right: -190px;float: right;"><span id="itemVrbjEndTime"></span></div>
</div>
</div>
<!-- Notice of transfer of petition matters End -->
There is no need to print in the middle, and it is also included with a DIV layer. Use CSS styles. Referring class="noprint" in a layer that does not require printing is done
The code copy is as follows:
<style type="text/css" media="print">
.noprint{visibility: none;}
</style>
JS code:
Note: When selecting printing, the style will be lost. You need to add your print before printing.
The code copy is as follows:
$(function(){
$("#print").click(function(){
var html = window.document.body.innerHTML;
exportCSS("itemVrbjForm",html);
});
//Import style to select printing
function exportCSS(formName,htmlInfo){
var CSS = "<link href=/""+ baseURL +"/zjxf/common/css/common.css/" type=/"text/css/" rel=/"stylesheet/" /> " +
"<link href=/""+ baseURL +"/zjxf/common/css/table.css/" type=/"text/css/" rel=/"stylesheet/" /> " +
"<link href=/""+ baseURL +"/zjxf/common/css/form.css/" type=/"text/css/" rel=/"stylesheet/" />" +
"<link href=/""+ baseURL +"/zjxf/common/css/tab.css/" type=/"text/css/" rel=/"stylesheet/" />" +
"<link href=/""+ baseURL +"/zjxf/common/css/print.css/" type=/"text/css/" rel=/"stylesheet/" />" ;
$(CSS).appendTo("#" + formName);
window.document.body.innerHTML = $("#" + formName).html();
window.print();
window.document.body.innerHTML = htmlInfo;
}
});
This allows both partial selection printing and partial non-select printing to be achieved