<target>

Description

A target specific graphical image specification.

The <target> element allows different image specifications to be used for different targets inside a <graphic> element. The attributes of the <target> element are the same as those for the <graphic> element, with the addition of the target and variant attributes.

When using child target elements, graphic attributes may be specified on the main graphic element parent and the child target elements. Any attributes specified on the graphic element that are also specified on the applicable target element are overridden by the target element's attribute.

Attributes

Attribute name Description
target Apply this image specification only for the specified targets.
variant Apply this image specification when the variant is specified during translation.
url An url to the image to render.
position The position of the image. Possible values are "left", "right", "inline" or nothing. When this attribute is not present, the image is centred with no text wrap around. When the graphic element is placed inside a pararaph or list entry, the position is automatically inline.
width The width of the image. Measurements can be specified in %, mm, cm, pt, or px. If the width attribute is specified without the height attribute, the height is automatically set by maintaining the aspect ratio.
height The height of the image. Measurements can be specified in %, mm, cm, pt, or px. If the height attribute is specified without the width attribute, the width is automatically set by maintaining the aspect ratio.
dpc If the width/height is specified in pixels, the dpc attribute may be specified in order to provide a dimensional unit to the pixel amount(s). For example, if the width is specified as 500 pixels and the dpc attribute is set to 100, the resulting image will be 5cm across. When both the dpc and the dpi attributes are present, the dpc value is used. The dpc attribute has no effect when the width/height are not specified in pixels.
dpi If the width/height is specified in pixels, the dpi attribute may be specified in order to provide a dimensional unit to the pixel amount(s). For example, if the width is specified as 400 pixels and the dpi attribute is set to 200, the resulting image will be 2 inches across. When neither the dpc or dpi attributes are present, the dpi defaults to 300 when the width/height is/are specified in pixels. The dpi attribute has no effect when the width/height are not specified in pixels.

Immediate descendants

No element descendants are defined for the <target> element.

Immediate ancestors

Element name Relation
<graphic> The enclosing graphic element.

Example

<document xmlns="http://boradoc.org/1.0">
  <chapter>
    <graphic position="left" url="images/open-book.jpg">
      <target target="pdf" width="40%" />
      <target target="html" width="20%" />
    </graphic>
    <lorem />
  </chapter>
</document>

The above BDML renders to the following:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.