page.SetSize(w, h)
Sets width and height in one call, one COM round trip cheaper than assigning them separately.
Signature
page.SetSize(w, h)
Notes
Sets width and height in one call, one COM round trip cheaper than assigning them separately.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
page = doc.ActivePage
W_MM, H_MM = 210, 297 # target in millimetres
page.SetSize(W_MM / 25.4, H_MM / 25.4) # set both dimensions at once, one less COM round trip
print("Set to A4: ", page.SizeWidth, "x", page.SizeHeight)
About this section: Page
Page — pages and page setup.
- This section has 15 entries; this is one of them.
- See the full section index: Page
Other entries in this section
- page.SizeWidthPage width, read/write, in doc.Unit. In the code = 1490/25.4 sets it t
- page.SizeHeightPage height, same rules. Note that CDR's Y axis points up, so Top is a
- page.OrientationLandscape or portrait.
- page.ActiveLayerThe active layer of this page. Every Create* method lives on a Layer,
- page.LayersThe layer collection: page.Layers.Count and .Item(i). This is how you
- page.ShapesAll top-level shapes on the page. To reach the ones inside groups and
- page.Activate()Switches to this page. It moves the UI too, which is slow — skip it in
- page.Delete()Deletes this page. The indexes of later pages shift down, so deleting