简体   繁体   English

发票不在右侧打印

[英]Invoice is not printing at right side

I am using following code to print my html content. 我正在使用以下代码来打印我的html内容。 My code is below 我的代码如下

Code is ok I am facing problem that 代码还可以,我面临的问题是

 function printDiv(divId) { window.frames["print_frame"].document.body.innerHTML = document.getElementById(divId).innerHTML; window.frames["print_frame"].window.focus(); window.frames["print_frame"].window.print(); }; 
 <span class="print"> <a href="javascript:printDiv('invoice')">print</a> <iframe name="print_frame" width="0" height="0" frameborder="0" src="about:blank"></iframe> </span> <div id="invoice" style="margin: 10px 20px;margin-bottom: 35px;-webkit-box-shadow: 0 0 6px #ccc;box-shadow: 0 0 6px #ccc;"> <div style="float:right;width:35%;text-align:right;"> <span style="font-size: 24pt;right: 0 ">INVOICE</span> <br> <span style="font-size: 10pt;right: 0"><b># 345</b></span> </div> .... </div 

My problem is INVOICE is not showing at fully right side. 我的问题是INVOICE没有显示在完全右侧。 HOw to resolve this 如何解决这个问题

The body adds 8px margin. 主体增加了8px的边距。 Could this be the issue? 这可能是问题吗? You could resolve it by adding the following CSS: 您可以通过添加以下CSS来解决它:

body {
   margin: 0;
}

Or if you can't do this just push the invoice text further to the right: 或者,如果您不能执行此操作,只需将发票文本进一步向右推:

<span style="font-size: 24pt;right: -8px ">INVOICE</span>
<br> <span style="font-size: 10pt;right: -8px;"><b># 345</b></span>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM