Safe width in pixels for printing web pages?

后端 未结 7 2227
无人及你
无人及你 2020-11-30 23:51

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 abo

相关标签:
7条回答
  • 2020-12-01 00:38

    It's not as straightforward as looks. I just run into a similar question, and here is what I got: First, a little background on wikipedia.

    Next, in CSS, for paper, they have pt, which is point, or 1/72 inch. So if you want to have the same size of image as on the monitor, first you have to know the DPI/PPI of your monitor (usually 96, as mentioned on the wikipedia article), then convert it to inches, then convert it to points (divide by 72).

    But then again, the browsers have all sorts of problems with printable content, for example, if you try to use float css tags, the Gecko-based browsers will cut your images mid page, even if you use page-break-inside: avoid; on your images (see here, in the Mozilla bug tracking system).

    There is (much) more about printing from a browser in this article on A List Apart.

    Furthermore, you have to deal width "Shrink to Fit" in the print preview, and the various paper sizes and orientations.

    So either you just figure out a good image size in inches, I mean points, (7.1" * 72 = 511.2 so width: 511pt; would work for the letter sized paper) regardless of the pixel sizes, or go width percentage widths, and base your image widths on the paper size.

    Good luck...

    0 讨论(0)
提交回复
热议问题