如何找到一个纸张尺寸/可打印尺寸,并设置打印页眉和页脚? [英] How to find a paper size / printable size and set the header and footer on print?

查看:391
本文介绍了如何找到一个纸张尺寸/可打印尺寸,并设置打印页眉和页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一些什么困难我。我的客户需要与页眉和页脚在每一页上打印数据的。

This is some what difficult me. My client require to print the data's with header and footer on each page.

有是使用 A4,A3,A5 风景论文的机会。如何我可以设置页眉和页脚在每个页面的?

There is a chance to use a A4, A3, A5 and Landscape papers. How can i able to set the header and footer on each of the page?

和我如何能够根据页面设置的数据长度?有没有一种方法来创建打印模板?

And how can i able to set a data length according to the page? is there a way to create print template?

我使用强调模板骨干

中的任何一个建议我的方式吗?

Any one suggest me a way please?

推荐答案

有关您的问题,不,你使用的模板引擎的区别。

For your issue no difference which template engine you use.

有关干什么用JavaScript一些HTML文档已被打印之前,你可以使用:

For doing something with javascript before HTML Document has been printed you could use:

有关Firefox和InternetExplorer的 - window.onbeforeprint

For Firefox and InternetExplorer - window.onbeforeprint.

解决方法对于其他浏览器 - window.matchMedia(打印 )

Workaround for other browser - window.matchMedia('print').

有关,当用户试图打印页有漂亮的外观更好的方法是使用CSS媒体查询,这将适用于特定的规则,当用户想要打印的HTML文档:

The better way for having nice look when user tries to print page is to use CSS's media queries, which will apply particular rules when user want to print the HTML Document:

<link rel="stylesheet" media="print" href="print.css" />

或添加媒体查询到你的CSS文件:

or add media query to your css file:

@media screen {
   body {font-family:verdana, arial, sans-serif;} // this will apply to printed page
}

这篇关于如何找到一个纸张尺寸/可打印尺寸,并设置打印页眉和页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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