mText

Top  Previous  Next
Mtext( { xpos, yPos }, text, horizontal alignment, width ) => Multi line text, automatically fits the given text into the specified coordinates, aligning the text horizontally relative to xPos.

 

yPos (numeric) : specifies the vertical position according to the coordinate system for the document, where text output will begin.

 

xPos (numeric) : specifies the horizontal position for the text output. This parameters is used by XbpGraPDF 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 XbpGraPDF 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 (in terms of characters), if this parameter is not present, the width will be of the longest line present at the text.

 

Examples : for this example the text will be “This is a sample” (one word on each line)

                       Text := “This” + nl + “is” + nl + “a” + “Sample”

                       GraPdf:Box( {10, 0}, {18, 20} )

                       GraPdf:Line( {14, 0}, {14, 20} )

                       GraPdf:Line( {10, 10}, {14. 10} )

 

                       GraPdf:mText( {10, 10}, text, 0 )                   (1)

                       GraPdf:mText( {10, 10}, text, 1 )                   (2)

                       GraPdf:mText( {14, 10}, text, 2 )                   (3)

                       GraPdf: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.