paged.IDML Reference
Anchored & inline objects

Anchored objects

The element model of an IDML anchored object, a page item nested in a CharacterStyleRange, and every attribute of its AnchoredObjectSetting.

Tier: ProProIIIreference

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.

Stories/Story_ustory.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="20.0">
  <Story Self="ustory">
    <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
        <Content>A paragraph that carries an inline object </Content>
        <Rectangle Self="uanchor" AppliedObjectStyle="ObjectStyle/$ID/[None]" ItemTransform="1 0 0 1 0 0" FillColor="Color/Black" StrokeColor="Swatch/None" StrokeWeight="0">
          <Properties>
            <PathGeometry>
              <GeometryPathType PathOpen="false">
                <PathPointArray>
                  <PathPointType Anchor="0 0" LeftDirection="0 0" RightDirection="0 0"/>
                  <PathPointType Anchor="0 18" LeftDirection="0 18" RightDirection="0 18"/>
                  <PathPointType Anchor="36 18" LeftDirection="36 18" RightDirection="36 18"/>
                  <PathPointType Anchor="36 0" LeftDirection="36 0" RightDirection="36 0"/>
                </PathPointArray>
              </GeometryPathType>
            </PathGeometry>
          </Properties>
          <AnchoredObjectSetting AnchoredPosition="InlinePosition" SpineRelative="false" LockPosition="false" AnchorPoint="BottomLeftAnchor" AnchorXoffset="0" AnchorYoffset="0"/>
        </Rectangle>
        <Content> in the middle of its line.</Content>
      </CharacterStyleRange>
    </ParagraphStyleRange>
  </Story>
</idPkg:Story>

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. A GeometricBounds attribute is not what InDesign uses for size.
  • Paint is FillColor, StrokeColor, StrokeWeight, FillTint and the rest, or an AppliedObjectStyle.
  • 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 TransparencySetting and a TextWrapPreference.

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 · AnchoredObjectSettingValuesPagedpaged.set
AnchoredPositionInlinePosition | AboveLine | AnchoredreadanchoredPosition
AnchorPointTopLeftPoint | TopCenterPoint | TopRightPoint | CenterLeftPoint | CenterPoint | CenterRightPoint | BottomLeftPoint | BottomCenterPoint | BottomRightPointreadanchorPoint
AnchorXoffsetlength (pt)readanchoredXOffset
AnchorYoffsetlength (pt)readanchoredYOffset
HorizontalAlignmentLeftAlignreadanchoredHorizontalAlignment
HorizontalReferencePointTextFramereadanchoredHorizontalReference
LockPositionfalsereadanchoredLockPosition
PinPositionfalse | truenot read
SpineRelativefalsereadanchoredSpineRelative
VerticalAlignmentBottomAlign | CenterAlign | TopAlignreadanchoredVerticalAlignment
The 10 attributes real documents use most. All 12 attributes of AnchoredObjectSetting →

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

ValuePlacement
InlinePositionIn the line, like a character. The default, and the only value in the surveyed documents' own objects.
AboveLineOn a line of its own above the line that holds the anchor.
AnchoredCustom: 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

  • AnchorYoffset moves 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.
  • AnchorXoffset is the horizontal offset of a custom object.
  • AnchorSpaceAbove is 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.
  • HorizontalReferencePoint is what it is measured from across: AnchorLocation (the anchor character), ColumnEdge, TextFrame, PageMargins or PageEdge.
  • VerticalReferencePoint is what it is measured from down: a line of the anchor (LineBaseline, LineXHeight, LineCapHeight, TopOfLeading), or TextFrame, PageMargins, PageEdge.
  • HorizontalAlignment (LeftAlign, CenterAlign, RightAlign) and VerticalAlignment (TopAlign, CenterAlign, BottomAlign) say which side of the reference the object goes to. For an above-line object, HorizontalAlignment places it in the column.
  • SpineRelative mirrors the horizontal placement on facing pages, so an object on the outside margin stays outside.
  • LockPosition keeps the object from being dragged by hand. It does not change where the object is placed. PinPosition is written beside it, true in 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. AnchorSpaceAbove is 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 spellings Custom and AbovePosition. 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.

On this page