You are on page 1of 1

CHAPTER 4: Graphics Graphic page items 116

Solution

The following steps assume the graphics frame already is selected.

1. Query for IConvertShapeSuite using ISelectionUtils.

2. Determine the shape you want to convert the selected item to, such as line, oval, rectangle, or
polygon.

 To convert to a polygon, you also need to determine the number of edges and star inset of the
polygon.

 To convert to a rectangle, you also may choose the corner effects you want to apply.

3. Call the ConvertPageItemShape method.

NOTE: IConvertShapeSuite has additional methods for connecting path points; however, these methods
are not tested.

Sample code

SnpManipulatePathandGraphics.cpp

Related APIs

IConvertShapeSuite

Graphic page items


Placing a graphics file into a spread
You can import a graphics file into an InDesign document and let the end user choose a position and size
for placing the file in a spread.

Solution

Use the kImportAndLoadPlaceGunCmdBoss command to import the file and load the place gun, so the
end user can place the item in the spread:

1. Create kImportAndLoadPlaceGunCmdBoss.

2. Query IImportResourceCmdData on the command and set the command data, including the
IDataBase of the document, the IDFile of the graphics file, and the UI flag.

3. Process the command.

NOTE: Generally, the process for importing a graphics file is the same as for importing other types of assets,
like text.

You might also like