开发者

IE7+ 'Shrink to Fit' making text too small

开发者 https://www.devze.com 2023-04-13 09:38 出处:网络
Have a page that displays <p>s in 12pt font. It prints fine in any browser except for IE7+. In IE7+ Shrink to Fit is selected by default in the user\'s browser and therefore it prints the text c

Have a page that displays <p>s in 12pt font. It prints fine in any browser except for IE7+. In IE7+ Shrink to Fit is selected by default in the user's browser and therefore it prints the text closer to 9pt.

We n开发者_运维技巧eed to have this text printed at 12pt. Is there any CSS or JS solution to force IE to print a specific font size?

Our only thought is to convert the page to a PDF and then have the user print the PDF.

Saw some people online recommend this command but it's not working for us.

document.execCommand('print', false, null);


OK..fixed my issue. I had a header div that was 850px wide and the body content was 720px. The header div didn't need to be 850px for printing because the bgimage was not printed in the print css.

So IE's "Shrink to Fit" was shrinking the page to the printable width (about 720px) and because the header was 850px the content div was scaled down along with the header. It made everything about 15% smaller to fit the 850px header in the printable page.

So just updated the header width to 720px and it prints the proper size now.


You can use conditional commenting for IE, this way you can specify separately what font you want to use for it

<!--[if IE 7]>   
    <link rel="stylesheet" href="css/ie7style.css">
<![endif]-->

There's a wide range of different ones you can use. This site lists them all

http://www.quirksmode.org/css/condcom.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号