用于打印网页的安全宽度(以像素为单位)? [英] Safe width in pixels for printing web pages?

查看:173
本文介绍了用于打印网页的安全宽度(以像素为单位)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打印网页的安全宽度(以像素为单位)是多少?

我的页面上有大图像,我想确保打印时不会被剪切掉.

我知道不同的浏览器页边距和美国Letter/DIN A4纸张尺寸.这样我们得到了标准的字母大小和一些默认的DPI值.但是我可以将它们转换为 pixel 值以在图像的width属性中指定吗?

解决方案

对于真正的通用答案",我无法提供.但是,我可以为某些细节提供简单而明确的答案...

670个像素

对于Microsoft产品,至少这似乎是一个安全的答案.我读了很多建议,包括675,但在自己测试之后,我想到了670.

除了所有DPI,页边距问题,硬件差异之外,此答案基于以下事实:如果我在IE9中使用打印预览(标准页边距)–并将打印尺寸设置为100%,而不是默认的缩小"来适应",一切都适合页面,而不会在此宽度处被剪掉.

如果我向自己发送HTML电子邮件并通过Windows Live Mail 2011(Outlook Express变成了后来者)接收了HTML电子邮件,并且我以670的宽度打印了页面–一切都合适.如果我将其发送到实际的硬拷贝或MS XPS文件(虚拟打印输出),则适用.

在进行实验之前,我使用了700的任意宽度.在上述所有情况下,页面的一部分都被截断了.当我降低到670时,一切都变得非常合适.

关于我如何设置宽度–我只是使用一个原始的包装" html表并将其宽度定义为670.

如果您可以决定最终用户的软件,那么这些事情就很简单了.如果您不能(通常如此),则可以测试其使用的浏览器等细节,并对重要的解决方案进行硬编码.在IE和FF之间,您将覆盖大约90%的Web用户.为其他每个人"添加一些其他代码,这些代码通常似乎可以正常工作,并称之为一天……"

What is the safe width in pixels to print a web page?

My page includes large images and I want to make sure they will not be cut of when printed.

I know about different browser margins and US Letter / DIN A4 paper sizes. So we got standard letter sized and some default DPI values. But can I convert these into pixel values to specify in the image's width attribute?

解决方案

As for a true "universal answer", I can’t provide one. I can, however, provide a simple and definitive answer for some particulars...

670 PIXELS

At least this seems to be a safe answer for Microsoft products. I read many suggestions, including 675, but after testing this myself 670 is what I came up with up.

All the DPI, margin issues, hardware differences aside, this answer is based on the fact that if I use print preview in IE9 (with standard margins) – and SET THE PRINT SIZE TO 100% rather than the default of "shrink to fit", everything fits on the page without getting cut off at this width.

If I send an HTML email to myself and receive it with Windows Live Mail 2011 (what Outlook Express became) and I print the page at 670 width – again everything fits. This holds true if I send it to an actual hard copy or a an MS XPS file (virtual printout).

Before I experimented, I was using a arbitrary width of 700. In all the scenarios mentioned above part of the page was getting cut off. When I reduced to 670, everything fit perfectly.

As for how I set the width – I just used a primitive "wrapper" html table and defined it’s width to be 670.

If you can dictate the end user’s software, such matters can be straight forward. If you cannot (as is usually the case of course) you can test for particulars like which browsers they are using, etc. and hardcode the solutions for the important ones. Between IE and FF, you will cover literally about 90% of web users. Put in some other code for "everyone else" which generally seems to work and call it a day...

这篇关于用于打印网页的安全宽度(以像素为单位)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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