//获取DPI
function js_getDPI() {
    var arrDPI = new Array();
    if ( window.screen.deviceXDPI != undefined ) {
        arrDPI[0] = window.screen.deviceXDPI;
        arrDPI[1] = window.screen.deviceYDPI;
    }
    else {
        var tmpNode = document.createElement( "DIV" );
        tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
        document.body.appendChild( tmpNode );
        arrDPI[0] = parseInt( tmpNode.offsetWidth );
        arrDPI[1] = parseInt( tmpNode.offsetHeight );
        tmpNode.parentNode.removeChild( tmpNode );
    }
    return arrDPI;
}
 var mm = pxValue/dpi*2.54*10;//dpi为上面获取的,自己对应XY轴

 

相关文章:

  • 2021-12-14
  • 2021-10-18
  • 2022-01-15
  • 2021-09-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2021-12-14
相关资源
相似解决方案