Home/ Reference/ Geometry & Transform

shape.SetPosition(x, y, anchor)

The default anchor is bottom-left; the third argument picks a different one. img.SetPosition((w - img.SizeWidth)/2, (h - img.SizeHeight)/2) centres an image on its b

Signature

shape.SetPosition(x, y, anchor)

Notes

The default anchor is bottom-left; the third argument picks a different one. img.SetPosition((w - img.SizeWidth)/2, (h - img.SizeHeight)/2) centres an image on its backplate.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

# SetPosition(x, y, anchor): positions by the bottom-left corner by default
shape.SetPosition(20 / 25.4, 30 / 25.4)

# to put the CENTRE at a point, subtract half the width and height
W, H = 210 / 25.4, 297 / 25.4              # page width and height
shape.SetPosition((W - shape.SizeWidth) / 2, (H - shape.SizeHeight) / 2)
print("Centred on both axes")

About this section: Geometry & Transform

Geometry & Transform — position, size and rotation of shapes.

Other entries in this section