使用javascript打印时未包含我的徽标
我正在为我的学校做一个项目,为什么我的商标没有包含在我的印刷版面中?。我正在通过ajax填充我的使用javascript打印时未包含我的徽标,javascript,html,css,image,printing,Javascript,Html,Css,Image,Printing,我正在为我的学校做一个项目,为什么我的商标没有包含在我的印刷版面中?。我正在通过ajax填充我的。现在我想把它包括在我的打印布局中。我怎么能包括这个 我尝试了下面的代码,但这不包括我的打印徽标 这是我的密码: <div class="border"> <div class="row"> <div class="cliniclogo" style="background-image
。现在我想把它包括在我的打印布局中。我怎么能包括这个
我尝试了下面的代码,但这不包括我的打印徽标
这是我的密码:
<div class="border">
<div class="row">
<div class="cliniclogo" style="background-image: url()">
</div>
<div class="col-md-12 text-center">
<div class="header-cert">
<p class="certheader"></p>
<p class="certheader" id="clinic_name"></p>
<p class="certheader"><label id="clinic_address"></label>, <label id="city_name"></label> </p>
<p class="certheader"><label id="province_name"></label>, <label id="zipcode"></label> </p>
</div><!-- header-cert -->
</div>
<div class="col-md-12 text-center">
<p class="medcert">MEDICAL CERTIFICATE</p>
</div>
</div><!-- row -->
<div class="row">
<div class="col-md-4 col-md-offset-10">
<p class="printingdate">Date: <u><?php echo "".date(' M j, Y'); ?></u></p>
</div>
</div><!-- row -->
<div class="row">
<div class="col-md-4">
<p class="certmarg">To Whom It May Concern:</p>
</div><!-- col-md-4 -->
</div><!-- row -->
<div class="row">
<div class="col-md-12 justifypar">
<p class="startindent">THIS IS TO CERTIFY that <label id="cert_name"></label> of <label id="cert_address"></label>
was examined and treated at the <label id="cert_clinic_name"></label> on <label id="cert_check_up_date"></label>
with the following diagnosis: <label id="cert_diagnosis"></label> and would need medical attention for
<label id="cert_physician"></label> days barring complication.</p>
</div>
</div><!-- row -->
<div class="signatory">
<div class="row">
<div class="col-md-4 col-md-offset-10">
<u><p id="cert_physician_signatory"><label id="cert_physician_sig"></label>, M.D.</p></u>
</div>
</div>
</div><!-- signatory -->
</div><!-- border -->
下面是我使用javascript打印的css(完整代码):
函数printDiv(){
var divToPrint=document.getElementById('printme');
var htmlToPrint=''+
'' +
“@page{”+
'大小:景观;'+
'}' +
“身体{”+
'字体系列:arial,无衬线;'+
'字体大小:12px;'+
'边框样式:双重;'+
'}' +
“.header证书{”+
'文本对齐:居中;'+
'页边距顶部:28px;'+
'填充:0px;'+
'}' +
“.certheader{”+
'字体大小:20px;'+
'保证金:0px;'+
'填充:0px;'+
'}' +
“.medcert{”+
'字体大小:38px;'+
'字体大小:粗体;'+
'文本对齐:居中;'+
'保证金:58px 58px;'+
'字间距:12px;'+
'}' +
“.printingdate{”+
'字体大小:19px;'+
'文本对齐:左;'+
'左边距:22px;'+
'保证金底部:53px;'+
'}' +
“.certmarg{”+
'字体大小:19px;'+
'文本对齐:左;'+
'左边距:22px;'+
'}' +
“.startindent{”+
'字体大小:19px;'+
'文本对齐:左;'+
'左边距:22px;'+
'右边距:14px;'+
'}' +
“#证书(医生)签字人{”+
'字体大小:21px;'+
'字体大小:粗体;'+
'文本对齐:左;'+
'左边距:22px;'+
'页边距顶部:95px;'+
'}' +
“.justifypar{”+
'文本对齐:对齐;'+
'文本对齐:单词间;'+
'}' +
“+
'显示:块;'+
'}' +
'';
htmlToPrint+=divToPrint.outerHTML;
newWin=window.open(“”);
newWin.document.write(htmlToPrint);
newWin.print();
newWin.close();
}
可能重复的(tl;dr:改用
)how-can-i-force-browsers-to-print-background-images-in-css@JJJ是否有任何解决方案可以在style=“background image:url()中打印出来?您阅读了我链接的副本了吗?我很确定您不可能在2分钟内尝试所有提到的解决方案。
'.cliniclogo { ' +
'display: block;' +
'}' +
function printDiv() {
var divToPrint = document.getElementById('printme');
var htmlToPrint = '' +
'<style >' +
'@page {' +
'size: landscape;' +
'}' +
'body {' +
'font-family: arial, sans-serif ;' +
'font-size: 12px ;' +
'border-style: double;' +
'}' +
'.header-cert{' +
'text-align: center;' +
'margin-top: 28px; ' +
'padding: 0px; ' +
'}' +
'.certheader { ' +
'font-size:20px;' +
'margin:0px;' +
'padding:0px;' +
'}' +
'.medcert { ' +
'font-size:38px;' +
'font-weight: bold;' +
'text-align: center;' +
'margin: 58px 58px;' +
'word-spacing: 12px;' +
'}' +
'.printingdate { ' +
'font-size:19px;' +
'text-align: left;' +
'margin-left: 22px;' +
'margin-bottom: 53px;' +
'}' +
'.certmarg { ' +
'font-size:19px;' +
'text-align: left;' +
'margin-left: 22px;' +
'}' +
'.startindent { ' +
'font-size:19px;' +
'text-align: left;' +
'margin-left: 22px;' +
'margin-right: 14px;' +
'}' +
'#cert_physician_signatory { ' +
'font-size:21px;' +
'font-weight: bold;' +
'text-align: left;' +
'margin-left: 22px;' +
'margin-top: 95px;' +
'}' +
'.justifypar { ' +
'text-align: justify;' +
'text-justify: inter-word;' +
'}' +
'.cliniclogo { ' +
'display: block;' +
'}' +
'</style>';
htmlToPrint += divToPrint.outerHTML;
newWin = window.open("");
newWin.document.write(htmlToPrint);
newWin.print();
newWin.close();
}