Different graphics for different published media

When a graphic needs to be presented differently for different output media, you should either include multiple versions of the graphics and use conditional processing to filter the required output, or use the keyref feature.

In many cases, the graphic used for a particular publishing output needs to be different to that used for an alternative output. For example, a high resolution PNG image might be required for the PDF output of a topic, but a smaller JPG image required for an eBook output.

The keyref attribute introduced in DITA 1.2 allows different image files to be used for the same illustration when a different map is used. Provided a different map file is used for PDF and eBook outputs in the preceding example, the keyref would point to different image files in each map.

This technique would not be relevant if the same map was being used to generate both outputs.

Using the conkeyref attribute would be another strategy, where the figure or image element is transcluded using conref, where the conref source file is specified in the ditamap rather than in the conref attribute in the topic. Different variants of the ditamap, sharing (through nesting) everything except the conkeyref targets, would also be required to complete the process.

Note: Some publishing tools and processes also allow you to swap the images (during processing) with images of the appropriate size and resolution for the target output.