|
|
|
|
|
- Origin and physical margins
- Managing the parameter
- Combining positions ( parameter)
- Printing in Java and Android
iXPos (Function) In french: iPosX Controls the horizontal position (abscissa or column) of the print cursor on the page. You can: - find out the current horizontal position,
- modify the horizontal position of print cursor.
Remark: When printing a Text string, the current vertical position points to the top of the string to be printed.. The bottom print line depends on the height of the fonts used in the printed line.
iVLine(0, iPageHeight(), 1)
iXPos(iXPos() + 2)
iVLine(0, iPageHeight(), 3)
iEndPrinting()
Syntax
Finding out the horizontal position of print cursor Hide the details
<Result> = iXPos()
<Result>: Real Current horizontal position of cursor (in millimeters).
Modifying the horizontal position of print cursor Hide the details
<Result> = iXPos(<Horizontal position> [, <Immediate calculation>])
<Result>: Character string Requested horizontal position. <Horizontal position>: Real New horizontal position (X-coordinate) of print cursor (in millimeters). <Immediate calculation>: Optional boolean - True (by default) to immediately calculate the horizontal position.
- False if the horizontal position must be calculated when printing (when nesting positions for example). For more details, see remarks.
Remarks Origin and physical margins The origin (0,0) is located in the upper-left corner of the sheet. This origin takes the physical printer margins into account. Each printer includes physical margins in which no printing is possible. iMargin is used to define the "logical" print margins. If logical margins have been defined, iXPos manages the horizontal position according to these new margins Managing the <Immediate Calculation> parameter When <Horizontal position> is specified in iXPos, the function performs two actions at the same time: - Returns a control character string. This control character string modifies the print position when the string is printed.
- Immediately modifies the position of print cursor
The <Immediate Calculation> parameter is used to retrieve the control character string without modifying the current position of print cursor sMonTitre is string = "Titre impression"
iDestination(iViewer)
iXPos((iPageWidth() - iTextWidth(sMonTitre))/2)
iPrint(sMonTitre)
iXPos((iPageWidth() - iTextWidth(sMonTitre))/2, False)
iPrint(sMonTitre)
iPrint(iXPos((iPageWidth() - iTextWidth(sMonTitre))/2, True) + sMonTitre)
iPrint(iXPos((iPageWidth() - iTextWidth(sMonTitre))/2, False) + sMonTitre)
Combining positions (<Immediate Calculation> parameter) When combining positions, unexpected results may occur. For example, the following code: iXPos(50)
iPrint("Première partie" + iXPos(20) + "Seconde partie")
is not equivalent to: iPrint(iXPos(50) + "Première partie" + iXPos(20) + "Seconde partie")
In the first case, the entire character string is printed at horizontal position 20. In this case, iXPos(20) is run when the string is built, before the "First Part" string is printed. To obtain the same result, simply use function iXPos with parameter Faux: the iPosX(20, Faux) function will only be executed during printing. The same operation can be performed by iYPos.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|