如何设计一个网页打印友好? [英] How to design a webpage to be print friendly?

查看:217
本文介绍了如何设计一个网页打印友好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网页在A4尺寸纸张上打印的尺寸是多少?



澄清:在这种情况下,

澄清#2 :此网页是唯一的提案,因为它是一张收据。



<页面是为我公司工作的内部使用。



澄清3:此网页必须打印在一张A4尺寸的页面上 - 仅。

解决方案

回答



不同的样式表。



要在浏览器中查看,您可以将表格宽度设置为A4纸的宽度:21厘米。 (减去页边距18厘米。)



对于打印,表格的大小应为100%,这意味着打印机会填充页面的整个宽度,使用浏览器设置提供的边距。



可能工作



使表格足够窄,以确保页面边距安全。





没有办法实现使用HTML& CSS,



在线创建PDF并让用户下载它们。大多数浏览器都能够呈现PDF。


What are the right sizes for a webpage to be printed on A4 size paper? What other stuff should be considered?

*inline CSS is preferred in this case

Clarification: This web-page's only propose is to be printed, since it is a receipt.

Clarification # 2: This web-page is for the internal use of the company I'm working for. They would like it to look professionally designed receipt.

Clarification # 3: This web-page must be printed on one page -of A4 size- only.

解决方案

Answer

I'd recommend using two different style sheets.

For viewing in the browser you could set the table width to the width of an A4 paper: 21cm. (Minus margins 18cm.)

For printing the size of the table should be "100%", which means the printer fills the whole width of the page, using the margins given by the browser's settings. (Those page margins are what makes it impossible for you to make a printout look exactly the same.)

Possibly working

Make the table narrow enough to be safe it's in the page margins. Then center that table vertically.

Solution for perfect layout

There's no way you're going to achieve that with HTML & CSS, it's just not designed to allow exact layouts!

Create PDFs online and let the users download them. Most browsers are able to render PDFs anyway.

这篇关于如何设计一个网页打印友好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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