mPDF Manual – HTML control tags

textcircle

(mPDF >= 5.4)

textcircle – Draw a circle using specified text

Description

<textcircle  $r  $top-text  $bottom-text [ $divider ][ $space-width ] [ $char-width ] [ $href ] />

Draw a circle using specified text. One or both of top-text and/or bottom-text must be defined. The radius and font-size are user-defined, whilst the width and height of the generated object will be calculated from these values. Font-size should be set for <textcircle> using in-line CSS or specified in a CSS stylesheet as for any standard HTML tag. Other CSS styles supported on Circular Text are: border, margin, padding, color, background-color, font-family, font-size, font-weight, font-style, display, visibility, and opacity.

From mPDF >= 5.6 the CSS property <span class="parameter">$font-size</span> can be set to auto. This automatically sizes text to fill a semicircle (if both top and bottom set) or a full circle (if only one set).

Circular Text is displayed as though an in-line element. Automatic kerning will be applied to the text if useKerning is TRUE

Parameters

$r

Radius of circle. Any valid LENGTH can be entered

</span>

$top-text

This parameter defines text which will be centred on the top of the circle.

$top-text cannot contain any of the characters: < > & ‘ or “ and must use the appropriate HTML entities e.g. <textcircle top-text=”Brian&#039;s document” />  It is recommended that you use htmlspecialchars(‘Content’, ENT_QUOTES) for this.

Either top-text or bottom-text (or both) must be defined.

DEFAULT: BLANK

$bottom-text

This parameter defines text which will be centred on the bottom of the circle.

$bottom-text cannot contain any of the characters: < > & ‘ or “ and must use the appropriate HTML entities e.g. <textcircle bottom-text=”Brian&#039;s document” />  It is recommended that you use htmlspecialchars(‘Content’, ENT_QUOTES) for this.

Either top-text or bottom-text (or both) must be defined.

DEFAULT: BLANK

$divider

This parameter defines an optional string of characters which will be used to divide top and bottom text of the circle.

$divider cannot contain any of the characters: < > & ‘ or “. Use HTML entities for special charactesr or non-ASCII characters e.g. <textcircle divider=”&bull;” />

DEFAULT: BLANK

$space-width

This parameter should be specified as an integer defining the (fixed) letter-spacing as a percentage of normal.

DEFAULT: 120

$char-width

This parameter should be specified as an integer defining the width of each character as a percentage of normal.

DEFAULT: 100

Changelog

VersionDescription
5.4 The tag was added.
5.6 Transparent background fixed. Support for divider added. Support for "font: auto" added.

Examples

Example #1

<?php

...

$mpdf->WriteHTML('<textcircle r="30mm" space-width="120" char-width="150"

top-text="&amp;bull; Circular Text &amp;bull;" bottom-text="Circular Text"

style="background-color: #FFAAAA; border:1px solid red; padding: 0.3em; margin: 0.3em; color: #000000; font-size: 21pt; font-weight:bold; font-family: Arial" />');

...

?>

See Also