Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
599 views
in Technique[技术] by (71.8m points)

javascript - Google Docs Pixels to Inches

Is anyone aware of the formula google docs use to convert pixels to inches?

Right click on a cell and click table properties then you get the image below, note I have opened up firebug and you can clearly see each td is set with a px width. I can work with inches or mm or equivalent for printing to pdf but pixels is not so accurate.

This is all done on client side hence the javascript tag...

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Haroon, I'm not sure what you're trying to do, but PC displays are generally 96DPI and I think google have emulated this with the zoom level they have set in their documents webapp.

We can confirm it's close, by taking a screenshot of googledocs and pasting it into paint, and then measuring the document width.

I got 796 pixels from my select tool in paint. I am using A4 portrait pages that are 210mm wide. This means we can do 796/210 to get our pixel density.

1 millimetre = 3.79 pixels

multiply by 2.54

1 inch = 96 pixels

I don't know if this will remain consistent with other monitor resolutions or paper sizes, but I would expect it would be close!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...