Background color

The DocBook XSL stylesheets allow you to specify a background color for the viewport of a graphic. If you specify a viewport larger than the image, and center the image in the viewport, then you can create a matte border for the image.

The background color is specified using a <?dbhtml?> or <?dbfo?> processing instruction within the imageobject element. This example includes one of each:

  <imageobject><?dbhtml background-color="#E8E8E8"?><?dbfo 
    <imagedata  width="10cm"  contentwidth="8cm"  
                depth="10cm"  contentdepth="8cm"  
                align="center" valign="middle"

The processing instruction name must be background-color, and the value must be a color name or color number (expressed using the three-part hexadecimal number syntax #123456 used for HTML colors).

This example creates a viewport 10 cm square, and centers the image scaled to 8 cm square in that area. That leaves a 1 cm border in the background color around the image.