i must convert px to cm with javascript
oneCM= 37.795276 is it true everytime?
What is the DPI's role here?
and if is variable CM on the monitor (factor DPI) how can we find DPI's
Do you want DPI or PPI? - DPI is for printing, PPI for screens.
If you are talking about the "real" size of an image or a webpage on your screen we're talking about PPI. Common PC screens have approx. 80ppi, the macbook pro has 220ppi.
If you want to convert those, you first have to convert your wanted size from cm to inches and then multiply it with the wanted ppi.
1cm = 0.39inches
0.39inches * 80dpi = 31.5px
Vice versa:
900px / 80ppi = 11.25inches
11.25inches = 28.575cm
The same works with DPI for printing. You have to know the DPI of your printer (common printes have 72dpi, commercial printers have something between 150 - 600dpi).