在每页上打印页码,如4打印中的1张 [英] Print Page number on each page like 1 of 4 print

查看:128
本文介绍了在每页上打印页码,如4打印中的1张的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用window.Print()JavaScript函数打印动态生成的Html表。打印时在每页打印页眉和页脚时我都提到了风格。



它工作正常,现在我需要将页码放在页脚行中,如第1页4.



Internet Explorer>>文件>>页面设置>>它显示页眉和页脚我想要实际更改标题值到页脚。



Internet Explorer>>文件>>页面设置>>页眉/页脚通过css





我想在打印内容时停止显示页眉,页脚将显示页码Internet Explorer您可以直接进入页面设置并删除标题的& w& bPage& p& p和页脚的& u& b& d,它们显示页码和URL。



但是,我正在为许多用户开发一个Web应用程序,他们不希望显示此URL和页码。而不是绕过每台PC并更改其Internet Explorer中的页面设置设置 - 是否可以使用用户想要打印的网页中的JavaScript代码修改页眉和页脚值。如果是这样,这是如何实现的。如果以前有过这方面的讨论,请指向我的主题。





请帮忙,我该如何设置页码?< br $> b $ b

 < style  type =text / css> 

@ media print {
thead { display table-header-group; }
tfoot { display table-footer-group;
}
}
@ media screen {
thead { display 阻止; }
tfoot { display block;
}
}
< / style >





我尝试了这个,但它没有工作



  @ page  :left  {
@ bottom-left {
content counter(page);
}



}

解决方案

你好,如果你得到答案,请更新答案


 <! -    这只适用于firefox浏览器,我仍在寻找其他浏览器的解决方案。 
< div class =footer_info_Mhstyle =width:100%>< / div>
< style>

< / style>
.footer_info_Mh:{
counter-increment:page;
内容:页面计数器(页面);
text-align:center; }


I am Printing dynamically generated Html table using window.Print() "JavaScript" function. To print header and footer on each page when print I used bellow mention style.

It's working properly, now I need to put page number in footer row like page 1 of 4.

Internet Explorer >> File >> Page Setup >> It shows header and footer I want change header value to footer pragmatically.

Internet Explorer >> File >> Page Setup >> Header/footer via css


I want to stop the header from being displayed when you print something and footer will show page number out in Internet Explorer you can simply go into the Page Setup and remove the "&w&bPage &p of &P" for the header and "&u&b&d" for the footer, which show the page numbers and URL.

However, I am developing a web application for a number of users and they will not want to have this URL and the page number displayed. Instead of going around to each PC and change the page setup settings in their internet explorer - is it possible to modify the header and footer values with JavaScript code in the web page that the user will want to print. And if so how is this achieved. If there is a previous discussion on this please point me to the thread.


Please help, how can I set page number?

<style type="text/css">

         @media print {
                         thead { display: table-header-group; }
                         tfoot { display: table-footer-group;
                                }
                     }
         @media screen {
             thead { display: block; }
             tfoot { display: block;
                   }
         }
     </style>



I tried this but its not working

@page :left {
       @bottom-left {
         content: counter(page);
      }


}

解决方案

hello do you get the answer if you get that please update the answer


<!--This works only in firefox browser still i'm looking for solution to other browsers.
<div class="footer_info_Mh" style="width: 100%"></div>
<style>

</style>
.footer_info_Mh:after{
counter-increment: page;
content:"Page " counter(page); 
text-align: center;  }	


这篇关于在每页上打印页码,如4打印中的1张的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆