Anchored objects
The element model of an IDML anchored object, a page item nested in a CharacterStyleRange, and every attribute of its AnchoredObjectSetting.
An anchored object is a page item written as a child of a CharacterStyleRange, with one <AnchoredObjectSetting> child that says where it goes.
In short The object is the same element it would be on a spread, a <TextFrame>,
<Rectangle> or <Group>, with the same attributes and the same <Properties>: its outline,
fill, stroke, transparency and text wrap. Its position in the run is its anchor. The
<AnchoredObjectSetting> holds the placement: the mode (InlinePosition, AboveLine or
Anchored), offsets, and for custom placement the reference points and alignments.
The object element
A Rectangle nested in a run, between two Content elements, with an AnchoredObjectSetting. The story has one run; laid out, the line has the text, the object, and the text again.
Everything about the object itself is written as for a page item on a spread:
- The outline is in
<Properties><PathGeometry>, in the object's own coordinates. AGeometricBoundsattribute is not what InDesign uses for size. - Paint is
FillColor,StrokeColor,StrokeWeight,FillTintand the rest, or anAppliedObjectStyle. - A text frame has its own story, named by
ParentStory. - A group holds its members as on a spread.
- A graphic frame holds its
<Image>as on a spread. - Effects and text wrap are a
TransparencySettingand aTextWrapPreference.
The object's ItemTransform is written as for any item, but where it lands on the page follows
from the anchor and the setting, not from the transform alone.
<AnchoredObjectSetting>
| Attribute · AnchoredObjectSetting | Values | Paged | paged.set |
|---|---|---|---|
| AnchoredPosition | InlinePosition | AboveLine | Anchored | read | anchoredPosition |
| AnchorPoint | TopLeftPoint | TopCenterPoint | TopRightPoint | CenterLeftPoint | CenterPoint | CenterRightPoint | BottomLeftPoint | BottomCenterPoint | BottomRightPoint | read | anchorPoint |
| AnchorXoffset | length (pt) | read | anchoredXOffset |
| AnchorYoffset | length (pt) | read | anchoredYOffset |
| HorizontalAlignment | LeftAlign | read | anchoredHorizontalAlignment |
| HorizontalReferencePoint | TextFrame | read | anchoredHorizontalReference |
| LockPosition | false | read | anchoredLockPosition |
| PinPosition | false | true | not read | |
| SpineRelative | false | read | anchoredSpineRelative |
| VerticalAlignment | BottomAlign | CenterAlign | TopAlign | read | anchoredVerticalAlignment |
The same element appears in object styles, where it gives anchored objects that use the style their placement, and in the document preferences as the default. On an object, a missing attribute comes from the object style, then from those defaults.
The mode: AnchoredPosition
| Value | Placement |
|---|---|
InlinePosition | In the line, like a character. The default, and the only value in the surveyed documents' own objects. |
AboveLine | On a line of its own above the line that holds the anchor. |
Anchored | Custom: positioned against a reference point, a frame, the column or the page. |
What each mode does to the object and the surrounding lines is explained on inline vs anchored positioning.
Offsets and spacing
AnchorYoffsetmoves an inline object up from the baseline (positive is up). For an above-line object it is the space after the object, before the anchor's line. For a custom object it is the vertical offset from the reference point.AnchorXoffsetis the horizontal offset of a custom object.AnchorSpaceAboveis the space above an above-line object.
Custom placement
A custom (Anchored) object is placed by matching a point of the object to a point of a
reference:
AnchorPoint, one of nine (TopLeftAnchor,TopCenterAnchor, …BottomRightAnchor), is the point on the object.HorizontalReferencePointis what it is measured from across:AnchorLocation(the anchor character),ColumnEdge,TextFrame,PageMarginsorPageEdge.VerticalReferencePointis what it is measured from down: a line of the anchor (LineBaseline,LineXHeight,LineCapHeight,TopOfLeading), orTextFrame,PageMargins,PageEdge.HorizontalAlignment(LeftAlign,CenterAlign,RightAlign) andVerticalAlignment(TopAlign,CenterAlign,BottomAlign) say which side of the reference the object goes to. For an above-line object,HorizontalAlignmentplaces it in the column.SpineRelativemirrors the horizontal placement on facing pages, so an object on the outside margin stays outside.LockPositionkeeps the object from being dragged by hand. It does not change where the object is placed.PinPositionis written beside it,truein nearly every surveyed file.
In Paged: all three modes are placed at their anchors. Custom objects resolve every horizontal and vertical reference above against the anchor line's real font metrics and the page's margins, and apply the offsets.
AnchorSpaceAboveis not applied yet, and text wrap around an anchored object is not applied. Anchored objects can be inserted and edited in Paged. Paged also accepts the spellingsCustomandAbovePosition. Supported · verified Supported · verified Tracked
Anchored objects and counts
An anchored object belongs to its story, not to the spread: it is not a spread item, and the run that holds it stays one run in the XML. Laid out, an inline object occupies a position in its line like a character, so tools that count laid-out runs see one more piece on that line.
Frequently asked questions
Which elements can be anchored?
Page items. The surveyed documents anchor text frames, rectangles and groups. The element is
written exactly as it would be on a spread, inside a CharacterStyleRange.
Where does an anchored object's size come from?
From its outline, <Properties><PathGeometry>, as for any page item.
What does AnchoredPosition="Anchored" mean?
Custom placement: the object is positioned against the reference points named by
HorizontalReferencePoint and VerticalReferencePoint, with AnchorPoint, the alignments
and the offsets.
Do object styles carry anchoring settings?
Yes. An object style can contain an <AnchoredObjectSetting>, and the document preferences
carry the defaults.
Does LockPosition change where the object appears?
No. It only prevents moving the object by hand in InDesign.
Anchored & inline objects
An anchored object is a page item written inside a run of text instead of on the spread, so it moves with the words; how IDML expresses that nesting.
Inline vs anchored positioning
What inline, above-line and custom placement of an anchored object do to the object and to the lines around it, as InDesign lays them out.