Faced such a problem - I need to specify the size of the canvas element 93mm x 53mm, but I can only set the size in pixels. It turns out this problem has no solution or how? Just 1mm can be a different number of pixels, depending on the resolution of the monitor. Tell me, please, what should I do in this situation?

    2 answers 2

    style="width:93mm; height:53mm" 

    // The solution is quite working on most systems.

     <body> <div id="ppitest" style="width:1in;visible:hidden;padding:0px"></div> </body> 

    Js:

     <script>screenPPI = document.getElementById('ppitest').offsetWidth; scrinPPMM = screenPPI/25.4;//Стока пикселей в одном миллиметре на данном экране. Дальше справитесь? </script> 
    • Yes, thank you so much, I can handle it! - spoilt