mText |
-
Mtext( init line, init col, text, horizontal alignment, width, lUTF ) => Multi line text, automatically fits the given text into the specified coordinates, aligning the text horizontally relative to init col.
Init line (numeric) : specifies the vertical position according to the coordinate system for the document, where text output will begin.
Init col (numeric) : specifies the horizontal position for the text output. This parameters is used by XbpPDF according to the horizontal alignment chosen. On left alignment (standard) and on justified the left margin of the text is aligned to the specified column, on right alignment the end of the text lines are aligned to the column, and on center the text is centralized on the column position.
Text (characters) : is the text to be outputted at the document, this text could be several lines of text, separated by NL ($0D0A) characters, or in the case of justified alignment one long string (there is no limit). Text should conform to memo fields formats.
Horizontal alignment (numeric) : is the type of alignment to be performed by XbpPDF on adding the text to your document.
Possible values for horizontal alignment are : Left => 0 (Default)
Right => 1
Center => 2
Justified => 3
Width (numeric) : on justified the optional parameter width specifies the line width, if this parameter is not present, the width will be of the longest line present at the text.
lUTF (logic) : indicates if the string is a normal ANSI text (false), or if it is an UNICODE text (true). (Default is false)
Examples : for this example the text will be “This is a sample” (one word on each line)
Text := “This” + nl + “is” + nl + “a” + “Sample”
oPdf:Box( 10, 0, 18, 20 )
oPdf:Line( 14, 0, 14, 20 )
oPdf:Line( 10, 10, 14. 10 )
oPdf:mText( 10, 10, text, 0 ) (1)
oPdf:mText( 10, 10, text, 1 ) (2)
oPdf:mText( 14, 10, text, 2 ) (3)
oPdf:mText( 18, 10, text, 3, 16 ) (4)
2 This
Is
A
Sample
|
This 1
Is
A
Sample
|
3 This
Is
A
Sample
| |
4 This Is a Sample
of Justified Text
|
Notice that all mText calls use column 10, so the positioning of the text varies according to the chosen alignment.
Text position is calculated according to font/page size specifications, and also according to fixed or proportional character spacing, proportional character spacing may not align text correctly, so if you use right or center alignment, please check your character width settings, this setting can be changed either in the oPdf:Font() call, or changing the oPdf:lFixed var contents.