AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de impresión
  • Print characteristics
  • Combining fonts
  • Combining positions
  • Printing in Java and Android
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Sends the character string passed as parameter to the print buffer.
A line break is automatically inserted at the end of the string: the cursor is positioned on the following line then. The move to the next line takes into account the height of the current line (in relation to the font used). The print job is not started (only iEndPrinting can be used to start the print job).
Remarks:
  • To print a character string without going to the next line, use iPrintWord.
  • iPrint must not be used in the opening code of a report.
Ejemplo
iPrint(iFont(2) + "Text in font 2")
iSkipPage()
// Customer name on the first line at 50 mm from the border
iPrint(iXPos(50) + Cu.CustName)
iEndPrinting()
Sintaxis
<Result> = iPrint(<Text to print> [, <String of next page>])
<Result>: Boolean
  • True if printed successfully,
  • False if the print job was canceled.
<Text to print>: Character string
Character string to print as well as its characteristics. This parameter has the following format:
[<Font Identifier> +] [<Vertical Position> +] [<Horizontal Position> +] <Text1>
...
[<Font Identifier> +] [<Vertical Position> +] [<Horizontal Position> +] <TextN>
where:
  • <Identifiant police> optional integer.
    Identifier of the font used to print the text. This identifier is returned by iFont. If this parameter is not specified, the last font used will be selected.
  • <Position verticale> optional integer.
    Y-coordinate of the point where the print must be performed. This position is specified in number of rows from the top left border of the sheet (with iYPos). If this parameter is not specified, the text will be printed at the current position.
  • <Position horizontale> optional integer.
    X-coordinate of the point where the print must be performed. This position is specified in number of columns from the top left border of the sheet (with iXPos). If this parameter is not specified, the text will be printed at the current position.
  • <Texte> String of characters.
    Character string to print.
Example:
Text_to_print = "First part" + iFont(1) + "Second part"
<String of next page>: Optional boolean
Specifies whether the text printed at the end of the page must be truncated or whether it must continue over the next page:
  • True (default value): the string will be printed on the next page if it does not fit on a single page.
  • False: the character string is truncated: the rest of the string is not printed on the next page.
Observaciones

Print characteristics

  • The origin (0,0) is located in the upper-left corner of the sheet. It takes the physical margins of the printer into account.
  • The current vertical position when printing a character string points to the upper part of the string. The bottom position depends on the height of the fonts used in the line to print.
  • You can specify multiple fonts and positions as parameters in a single call to iPrint. For example:
    iPrint(iXPos(50) + CU.LASTNAME + iXPos(150) + CU.FIRSTNAME)
  • The character corresponding to a line break (Char(10)) is interpreted as a line skip.

Combining fonts

Unexpected results may occur when combining fonts. For example, the following code:
iFont(2)
iPrint("First Part" + iFont(1) + "Second Part")
is not equivalent to:
iPrint(iFont(2) + "First Part" + iFont(1) + "Second Part")
In the first case, the entire character string is printed in font 1. In this case, the iPolice(1) function function is executed during the construction of the string to be printed, and therefore before the "First Part" string is printed.
To obtain the same result, simply use function iFont with parameter False parameter: the iPolice(1, False) function will then only really be executed during printing.

Combining positions

When combining positions, unexpected results may occur. For example, the following code:
iXPos(50)
iPrint("First Part" + iPrint(30) + "Second Part")
is not equivalent to:
iPrint(iXPos(50) + "First part" + iXPos(30) + "Second part")
In the first case, the entire character string is printed at horizontal position 30. In this case, the iPosX(30) function function is executed during the construction of the string to be printed, and therefore before the "First Part" string is printed.
To obtain the same result, simply use function iXPos with parameter False parameter: the iPosX(30, False) function will then only really be executed during printing.
The same operation can be performed by iYPos.
AndroidWidget Android Java

Printing in Java and Android

Printouts can be less precise because the print resolution is set to 72 dpi even if the printer supports higher resolutions.
As a consequence, the position of points of images and drawings (lines for instance) is rounded, especially when working with small values. During the print job, calculations are performed in points (depending on the print resolution) instead of mm (or cm).
Example: Lines: If lines are 0.5 mm apart, how many dots are there between each line in Java (72 dpi resolution)?
The first line is positioned at 0.5 mm which means (0.5/25.4) inches with a resolution of 72 points per inch (ppp): (0.5/25.4) x 72 = 1.42 point. The point being the base unit, it cannot be divided: the result is automatically rounded to 1 point less or greater depending on the case.
This is a succession of lines printed with a spacing set to 05 mm:
  • 0.5 mm --> (1.42) 1 point
  • 1.0 mm --> (2.84) 3 points
  • 1.5 mm --> (4.25) 4 points. Caution: the line at 1.5 mm is combined with the line at 1 mm (there is no space between these two lines)
  • 2.0 mm --> (5.67) 6 points
  • 2.5 mm --> (7.09) 7 points. Caution: the line at 2.5 mm is combined with the line at 2 mm (there is no space between these two lines)
  • 3.0 mm --> (8.50) 9 points
  • 3.5 mm --> (9.92) 10 points. Caution: the line at 3.5 mm is combined with the line at 3 mm (there is no space between these two lines)
  • 4.0 mm --> (11.33) 11 points. Caution: the line at 4 mm is combined with the line at 3.5 mm (there is no space between these two lines)
  • etc.
To get an accurate representation (without rounding), the size and/or the position in mm for a resolution set to 72 ppp must be a multiple of 127/360.
1 point --> (1/72) inches --> (1/72) x 25.4 mm = 127/360 = 0.3527778 mm
Componente: wd300prn.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local