Home/ Reference/ PowerClip

shape.AddToPowerClip(clipShape, centerInParent)

Puts the current shape inside the clipShape container. The second argument, True, centers it automatically. In the code: img.AddToPowerClip(pdf_rect, True).

Signature

shape.AddToPowerClip(clipShape, centerInParent)

Notes

Puts the current shape inside the clipShape container. The second argument, True, centers it automatically. In the code: img.AddToPowerClip(pdf_rect, True).

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
page  = doc.ActivePage
layer = page.ActiveLayer

# 1) draw a rectangle to act as the container
box = layer.CreateRectangle2(0, 0, 100/25.4, 80/25.4)

# 2) import an image (it arrives selected)
layer.Import("D:/images/photo1.jpg", 0, None)
img = app.ActiveSelectionRange(1)

# 3) place it inside; second argument True = centre it
img.AddToPowerClip(box, True)

print("Image placed into the frame")

About this section: PowerClip

PowerClip — clipping content into a frame.

Other entries in this section