page.SizeWidth * page.SizeHeight
Page area in square units. Use it as the denominator when you ask what fraction of the page an element occupies.
Signature
page.SizeWidth * page.SizeHeight
Notes
Page area in square units. Use it as the denominator when you ask what fraction of the page an element occupies.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
page = doc.ActivePage
w, h = page.SizeWidth, page.SizeHeight
area = w * h # the unit is squared document units
print("Page area: ", round(area, 3), "square units")
# convert to square millimetres (document unit is inch here)
area_mm2 = area * 25.4 * 25.4
print("roughly: ", round(area_mm2, 0), "mm²")
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
- 1 inch = 25.4 mm = 72 pt = 96 pxThe conversion basis. 1490/25.4 in the code converts 1490 mm to inches
- 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