I want to resize the font of a SPAN element's style until it the SPAN's text is 7.5 inches wide when printed out on paper, but JavaScript only reports the SPAN's clientWidth property in pixels.
<span id="test">123456</span>
And then:
#test
{
font-size:1.2in; /* adjust this for yourself until printout measures 7.5in wide */
}
And then:
console.log(document.getElementById('test').clientWidth);
I've determined experimentally on one machine that it uses approximately 90 DPI as a conversion factor, because the above code logs approximately 675, at least under Firefox 3.
This number is not necessarily the same under different browser, printer, screen, etc. configurations.
So, how do I find the DPI the browser is using? What can I call to get back "90" on my system?