Text string
Text string
Write text at a certain position on the page, with a specified font, colour and style. The colour can either be specified as RGB values, or by name.
Inputs
Input name |
Optional/required |
Notes |
Position |
Required |
Write the text at location (x,y). Position is relative to the top-left of the page, measured in mm. Note: this is the co-ordinate of the bottom left of the text block. If position (x2,y2) is also included, the text will fit within the box defined, and word-wrap as needed. |
FontDetails |
Required |
size: height of the font in mm (required) name: name of the font (optional, defaults to Arial) fontweight: if 1, text is written in bold (optional) italic: if 1, text is written in italics (optional) underline: if 1, text is underlined (optional) |
Colour |
Optional |
Can be either a/r/g/b values (see the Line type for an example), or the name of a colour. Defaults to black. |
Text |
Required |
The text to write on the page. |
Example
<PrintElement name="Label">
<Position x="10" y="10" ></Position>
<FontDetails size="5" name="Arial"></FontDetails>
<Text>This is an example of plain text with no formatting</Text>
</PrintElement>
<PrintElement name="Label">
<Position x="10" y="20" ></Position>
<FontDetails size="5" name="Arial" fontweight="1" ></FontDetails>
<Text>This text is bold</Text>
</PrintElement>
<PrintElement name="Label">
<Position x="10" y="30" ></Position>
<FontDetails size="5" name="Arial" italic="1" ></FontDetails>
<Text>This text is italic</Text>
</PrintElement>
<PrintElement name="Label">
<Position x="10" y="40" ></Position>
<FontDetails size="5" name="Arial" underline="1" ></FontDetails>
<Text>This text is underlined</Text>
</PrintElement>
<PrintElement name="Label">
<Position x="10" y="50" ></Position>
<FontDetails size="5" name="Arial" fontweight="1" italic="1" underline="1" ></FontDetails>
<Colour>red</Colour>
<Text>This text is bold, italic and underlined (and red!)</Text>
</PrintElement>
This produces the following output: