Home/ Reference/ Page

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 & Init
Python
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.

Other entries in this section