|
|
|
|
|
- Origin and physical margins
- Managing the parameter
- Combining positions ( parameter)
- Printing in Java and Android
iXPos (Function) In french: iPosX Allows you to manage the horizontal position (X coordinate) of print cursor in the page. You can: - find out the current horizontal position,
- modify the horizontal position of print cursor.
Remark: When printing a character string, the current vertical position points to the top of the string to print. The bottom print line depends on the height of the fonts used in the printed line.
// Draw vertical lines separated by two millimeters // across the entire page width iVLine(0, iPageHeight(), 1) // Draws a line iXPos(iXPos() + 2)  // Shifts  by 2 iVLine(0, iPageHeight(), 3) // Draws a line 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 sMyTitle is string = "Print title" iDestination(iViewer)
iXPos((iPageWidth() - iTextWidth(sMyTitle))/2)
iPrint(sMyTitle)
iXPos((iPageWidth() - iTextWidth(sMyTitle))/2, False)
iPrint(sMyTitle)
iPrint(iXPos((iPageWidth() - iTextWidth(sMyTitle))/2, True) + sMyTitle)
// --- CASE 3 B // The position of print cursor IS NOT modified when // running iXPos, BUT it is modified when // printing the character string that contains the result // returned by iXPos iPrint(iXPos((iPageWidth() - iTextWidth(sMyTitle))/2, False) + sMyTitle) // Must be centered
// End of print iEndPrinting() Combining positions (<Immediate Calculation> parameter) When combining positions, unexpected results may occur. For example, the following code: iXPos(50) iPrint("First part" + iXPos(20) + "Second part")
is not equivalent to: iPrint(iXPos(50) + "First part" + iXPos(20) + "Second part")
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 get the same result, use iXPos with the False parameter: iXPos(20, False) will only be executed when the print job is run. The same operation can be performed by iYPos.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|