Professional Documents
Culture Documents
Solutions 33
Solutions 33
The following example shows code that, given a UIDRef to a document (kDocBoss), creates a frame at the
origin of the first page in the document. The parent for the frame is the spread layer associated with the
first content layer in the first spread in the document.
This example creates a 100*100 point square graphic frame at the origin of the first page:
// 1. Determine the UIDRef of the parent.
InterfacePtr<ISpreadList> spreadList(docUIDRef, UseDefaultIID());
InterfacePtr<ISpread> spread(docUIDRef.GetDataBase(), spreadList->GetNthSpreadUID(0),
UseDefaultIID());
InterfacePtr<ILayerList> layerList(docUIDRef, UseDefaultIID());
IDocumentLayer* documentLayer = layerList->GetLayer(1);
InterfacePtr<ISpreadLayer> spreadLayer(spread->QueryLayer(documentLayer));
UIDRef parentUIDRef = ::GetUIDRef(spreadLayer);
if (spreadLayer->IsLocked() == kFalse) {
// 2. Determine the bounding box of the frame.
PMRect boundingBox(0, 0, 100, 100);
InterfacePtr<IGeometry> pageGeometry(spread->QueryNthPage(0));
::InnerToPasteboard(pageGeometry, &boundingBox);
Sample code
SDKLayoutHelper::CreateRectangleFrame
SnpCreateFrame
Related API
kSplineItemBoss
Creating a path
Solution
1. See “Creating an empty graphic frame” for the basic approach. Frames and paths both create spline
item boss objects, kSplineItemBoss. The significant difference is that a graphic frame is designated as
being a container for a graphics page item.
2. On calling the IPathUtils create spline method that creates the path you want, use attrType=
INewPageItemCmdData::kGraphicAttribute to create a path.
Related documentation