简体   繁体   English

在完整网页中打印出网页

[英]Print off web page in a full web page

When i want to print my web page, It will do print complete web page. 当我要打印网页时,它将打印完整的网页。 Is there any option to print off web page. 是否有任何选项可以打印出网页。 Now i am working for Invoice Statements. 现在,我正在处理发票对帐单。

It print's all page like menu,logout,print,and other whatever in my web page that will print automatically. 它打印所有页面,例如菜单,注销,打印以及我的网页中将自动打印的其他任何页面。 But i want to print only invoice details like company name, logo, address, invoice table, note, and signature. 但是我只想打印发票详细信息,例如公司名称,徽标,地址,发票表,便笺和签名。

Is it any then tell me how it is possible? 有没有话告诉我这怎么可能?

This code print full page 此代码打印整页

<script language="JavaScript"> 
if (window.print) {
 document.write('<form><input type=button name=print value="Print"     onClick="window.print()"></form>');
}
</script>

But i need to print invoice details only on that page. 但是我只需要在该页面上打印发票详细信息。

Thanks. 谢谢。

Add an extra stylesheet to your page, and make use of the media element: 在页面上添加一个额外的样式表,并使用media元素:

<link rel='stylesheet' media='screen,print' href='css/standardstylesheet.css'>

<!-- print stylesheet -->
<link rel='stylesheet' media='print' href='css/printStyles.css'>

In your print style sheet add selectors for elements you don't want to print, and set them to display:none : 在打印样式表中,为不想打印的元素添加选择器,并将其设置为display:none

#myMenu, #myNavBar, #someOtherElement {
    display:none;  /* Opacity:0; might work too. */
}

You might have to adjust the CSS to ensure that elements don't move around when your selected no-printing elements have disappeared. 您可能需要调整CSS,以确保所选的不打印元素消失后元素不会四处移动。

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

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