cnblogs/dcrenl/A4纸网页打印中对应像素的设定和换算.html
2024-09-24 12:43:01 +08:00

36 lines
1.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div id="sina_keyword_ad_area2" class="articalContent ">
<div>最近开发项目时遇到了网页打印的问题,这是问题之二,打印宽度设置</div>
<div><br />
</div>
<div>在公制长度单位与屏幕分辨率进行换算时必须用到一个DPI(Dot PerInch)指标。&nbsp;</div>
<div>经过我仔细的测试发现了网页打印中默认采用的是96dpi并非传闻的72dpi&nbsp;</div>
<div><br />
</div>
<div>A4纸张的尺寸是210&times;297mm按1英寸=25.41mm换算即8.264&times;11.688英寸&nbsp;</div>
<div><br />
</div>
<div>所以A4纸96dpi下的分辨率是794&times;1123这就是我们在制作网页的时候需要的象素。&nbsp;</div>
<div><br />
</div>
<div>但是打印机是无法满幅打印的,总要有页边距,所以我们在制作网页的时候必须减去页边距。&nbsp;</div>
<div><br />
</div>
<div>以下是我测试的各种页边距下A4纸对应的象素尺寸&nbsp;</div>
<div><br />
</div>
<div>打印页边距设定为 0mm 时网页内最大元素的分辨率794&times;1123&nbsp;</div>
<div>&lt;divstyle="width:794px;height:1123px;border:1px solid#000000;"&gt;&lt;/div&gt;&nbsp;</div>
<div><br />
</div>
<div>打印页边距设定为 5mm 时网页内最大元素的分辨率756&times;1086&nbsp;</div>
<div>&lt;divstyle="width:756px;height:1086px;border:1px solid#000000;"&gt;&lt;/div&gt;&nbsp;</div>
<div><br />
</div>
<div>打印页边距设定为 19.05mm 时网页内最大元素的分辨率649&times;978&nbsp;</div>
<div>&lt;div style="width:649px;height:978px;border:1pxsolid #000000;"&gt;&lt;/div&gt;</div>
<div><br />
</div>
<div>转自http://blog.163.com/shensc@126/blog/static/131289652201010911519150/</div>
</div>
<p>&nbsp;</p>