picture

Syntax

[#picture] expression [/#picture]

where:

Description

The picture tag can be used to insert an image. It makes sense to use this tag only when the path of the picture must be dynamically computed from expressions. If the path is static, you should rather insert the picture using the regular command in your authoring tool.

The expression evaluation must return a String. This String denotes the path of a picture in the file system. The picture formats handled by DocGen are: bmp, emf, gif, jpg, png, and wmf. If the file path is relative, it must be relative to the output file (see file tag). For example, if the doc template specifies an output file "c:\output\output.xml" and inserts a picture "images\myPicture.png", then this picture must be located in the directory "c:\output\images\"

Picture size

MDWorkbench inserts pictures using their original size (width and height). In some cases, pictures may be too large in the output document.

You can limit the size of the picture to insert using the following attributes:

The attribute maxWidth and maxHeight must be positive integers (pixel unit). A picture is resized (both width and height to maintain the ratio) to fit these maximum values, if necessary. For example, if a picture is 800 pixel long and maxWidth is set to 600, the picture is resized to be 600 pixel long.

Insertion mode

By default, MDWorkbench will embed the picture directly inside the generated document. That way, you have one document with no external reference.

However you may want to insert only a link to pictures in some cases (to optimize document weight when multiple documents reference the same diagrams, or to be able to update pictures without touching the document). You can control the insertion mode using the attribute insert.

The insert attribute can have the following values:

Examples

This will insert a picture whose path is computed from a Class name, and will scale it to be 600 pixels long at most:

[#picture maxWidth="600"]images/[#expr]myClass.name[/#expr].png[/#picture]