javascripthtmlgoogle-docsunit-conversion

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


Solution

  • 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!