<graphic>

Description

A graphical image rendered in the document.

Images may be positioned centred on the page, positioned to the left or right of the page with text flowing around them, or may be inlined with text inside paragraphs and list entries. Images inside paragraphs and list entries are automatically inline, regardless of the position as specified in the optional position attribute.

There are two ways to use the graphic element:

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

In addition to the following attributes, standard attributes may be defined on <graphic> elements.

Attribute name Description
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

Element name Description
<target> A target specification image specification.

Immediate ancestors

Element name Relation
<chapter> The enclosing chapter containing a centered, left justified, or right justified graphical image.
<ref> The enclosing hyperlink containing a graphical image.
<section> The enclosing section containing a centered, left justified, or right justified graphical image.
<para> The enclosing paragraph containing an inline graphical image.

Example

<document xmlns="http://boradoc.org/1.0">
  <chapter>
    <graphic url="images/open-book.jpg" width="100%" />
    <lorem />
    <graphic position="right" url="images/open-book.jpg" width="40%" />
    <lorem />
    <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.

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.

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.