1 inch = 25.4 mm = 72 pt = 96 px
The conversion basis. 1490/25.4 in the code converts 1490 mm to inches, which tells you doc.Unit on this machine is inches.
Signature
1 inch = 25.4 mm = 72 pt = 96 px
Notes
The conversion basis.
1490/25.4 in the code converts 1490 mm to inches, which tells you doc.Unit on this machine is inches.Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
MM = 25.4 # 1 inch = 25.4mm = 72pt = 96px
def mm(v):
"""Millimetres to document units (the document unit is inch here)"""
return v / MM
def pt(v):
"""Points to document units (inches)"""
return v / 72
print("210mm =", round(mm(210), 4), "inch")
print("72pt =", round(pt(72), 4), "inch")
print("A4 width 210mm =", round(mm(210), 2), " height 297mm =", round(mm(297), 2))
About this section: Units & Conversion
Units & Conversion — document units and conversion.
- This section has 8 entries; this is one of them.
- See the full section index: Units & Conversion
Other entries in this section
- doc.UnitThe current document unit (cdrUnit enum). Every geometry API follows i
- doc.Unit = cdrMillimeterSwitch to millimetres and you can write millimetres directly instead o
- Font size: points vs document unitsThe one measurement that ignores doc.Unit: the size argument of Create
- page.SizeWidth * page.SizeHeightPage area in square units. Use it as the denominator when you ask what
- shape.GetBoundingBox() → w*hBounding box area, for overlap tests like "are these two G's the same
- shape.Curve.Area / shape.Curve.LengthTrue area and perimeter. Curve objects only.
- RectIntersect: computing intersection areaOverlap of two rectangles: max(0, min(x1+w1, x2+w2) - max(x1, x2)) * m