ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Print functions
  • When should I use iPreview?
  • Print preview
  • End of print
  • Printer fonts
  • Re-running the report
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Warning
From version 25, iDestination should be used instead. This function proposes printing via the report viewer (called print preview in previous versions), the mini-preview window, as well as all other print destinations.
Configures the preview window. You can print:
  • on the printer directly (syntax 1).
  • in a preview window (syntax 2). The user can preview the print result on the screen, page by page. This window allows you to:
    • scroll the pages (next page and previous page if they exist),
    • start the print job,
    • modify the scale of preview,
    • display the first page or the last page,
    • find out the number of the current page, ...
  • WINDEV in a mini-preview window (syntax 3). This mini-preview allows you to view the page or pages to be printed, to define the printer to use, the use or not of color, the number of copies, ...
Note about compatibility
In the earlier versions, iPreview also allowed you to choose the print destination. These syntaxes have been kept for backward compatibility but iDestination must now be preferred for this use.
Remark: A warning message is displayed by default if the current computer may not have sufficient resources to display all pages in the preview (from 1000 pages). To avoid displaying this message or to configure the number of pages before displaying this message, use iParameterPreview.
WEBDEV - Server code The preview window is not available in this version.
WINDEVReports and QueriesUser code (UMC)
// Printing in a preview configuring the title of the preview window
IF iConfigure() = True THEN iPreview(iPage, "List of functions")
WINDEVReports and QueriesUser code (UMC)
// Opening the preview: 
// when starting for the first time: preview with zoom out
// in subsequent starts: keeping the values of the last preview
iPreview()
WINDEVReports and QueriesUser code (UMC)
// Open the mini preview
iPreview(iMiniPreview)
Syntax

Printing on the printer directly Hide the details

iPreview([<Destination> [, <Name of the document>]])
<Destination>: Optional integer constant
Print destination.
iPrinterSend document directly to the printer
WEBDEV - Server code To directly print on a printer connected to the server, a specific configuration is required. For more details, see Configuring the server to perform a print job.
<Name of the document>: Optional character string
Name that will be given to the print. This name will identify the printout in the list of documents processed by the printer.
WINDEVReports and QueriesUser code (UMC)

Printing in a preview window Hide the details

iPreview([<Zoom> [, <Preview window title> [, <Print buttons> [, <Horizontal position> [, <Vertical position> [, <Width> [, <Height>]]]]]]])
<Zoom>: Optional integer constant
Zoom when opening the preview window.
i2Pages
ipvZoom2Pages
Preview displaying 2 pages at a time.
i100
ipvZoom100
Preview with a zoom set to 100%.
iDefaultZoom
ipvZoomDefault
(default value)
Corresponds to:
  • ipvZoomPage when first used.
  • the last zoom set by the user in the print preview, for subsequent uses.
iPage
ipvZoomPage
Preview with zoom out: the page will be entirely displayed in the zoom window.
ipvZoomPageWidthPreview displaying the entire page width.
Value from 10 to 999Preview with the specified zoom.
If this parameter is not specified, the default value corresponds to:
  • ipvZoomPage when the function is first used.
  • the zoom set by the user in the print preview, for subsequent uses.
<Preview window title>: Optional character string
Title displayed in the title bar of the window. If this parameter is not specified, the default title will be "Report preview" followed by the report name.
If the user has the ability to generate some files (Word, PDF, ...) from the report viewer, the preview title will be automatically proposed as file name. If this parameter is not specified, the name of the file will correspond to the name of the report.
<Print buttons>: Optional boolean
  • True (by default) to display the buttons allowing the user to start the print,
  • False to avoid displaying the buttons.
<Horizontal position>: Optional integer
Horizontal position of preview window (in pixels). By default, the horizontal position corresponds to 100 pixels.
<Vertical position>: Optional integer
Vertical position of preview window (in pixels). By default, the vertical position corresponds to 100 pixels.
<Width>: Optional integer
Preview window dimensions (in pixels). By default, the dimensions of this window are set to 640 (width) by 480 (height).
<Height>: Optional integer
Preview window dimensions (in pixels). By default, the dimensions of this window are set to 640 (width) by 480 (height).
WINDEVReports and QueriesUser code (UMC)

Print in a mini-preview window Hide the details

iPreview([<Destination> [, <Title of the mini-preview window>]])
<Destination>: Integer constant
Print destination:
iMiniPreview
Displays the printout in a mini-preview window.
<Title of the mini-preview window>: Optional character string
Title displayed in the title bar of the mini-preview window.
If this parameter is not specified, the default title will be "Report preview" followed by the report name.
If the user can generate files (Word, PDF, etc.) from the print mini-preview, the title of the preview will automatically be proposed as the file name. If this parameter is not specified, the name of the file will correspond to the name of the report.
Remarks

When should I use iPreview?

iPreview must be the first print function called. It must be called before iPrint, iCreateFont, etc. However, iPreview must be called after iConfigure or iParameter.
Remark: iDestination must be called before printing a report (with iPrintReport) to choose the print destination.
WINDEVReports and QueriesUser code (UMC)

Print preview

1. Customizing the preview window
WINDEV allows you to customize the interface of the preview window. You can:
Remark: If the print preview allows you to send an email, the email characteristics can be configured by iParameterExport.
2. Zoom values
  • We do not recommend that you give a value less than 33% to the zoom, otherwise the buttons found in the preview window will be flatten and unreadable.
  • In zoom-out mode, depending on the requested font (for example, with some fonts that are smaller than 14), the font used by Windows to display the text is not proportional to the print font. This results in an incorrect display; however, the print will be correct.
3. Canceling preview
When previewing a report, iPrint and iPrintWord return False if the "Abandon" button was clicked by the end user. To test the abandon of the preview, you must write:
IF iPrint(Text) = False THEN RETURN
WINDEVUser code (UMC)

End of print

iEndPrinting must necessarily be called to end the print except after a call to iPrintReport.
WINDEV iEndPrinting cancels the print preview.
The next prints will be performed on the printer except if iPreview is run again.
WINDEV The configuration window (iConfigure) must not be called between two successive print previews without iEndPrinting being called beforehand.
WINDEVWEBDEV - Server code

Printer fonts

The printer manufacturers install fonts on their printers. These fonts are called "printer" fonts. Unlike the software fonts (such as "TrueType"), these fonts are directly accessible by the printer, they do not have to be loaded.
In the lists of fonts, the printer fonts are identified by a "printer" icon displayed in front of the name of the font.
If you are using printer fonts, these fonts will be interpreted by the printer only.
WINDEV Caution: unexpected display effects may occur when using the printer fonts. During the print preview, the display of the fonts is managed by Windows. As it does not support these specific fonts, Windows uses the nearest display font for the print preview.
Example: The following code prints bar codes on the printer but text on the screen.
iPreview(iPage)
iCreateFont(1, 20, iNormal, "Interleaved 2of5", Black, 0)
iCreateFont(2, 20, iNormal, "UPC/EAN", Black, 0)
iPrint(iFont(1) + "Test of printer font")
iPrint(iFont(2) + "Test of printer font")
iEndPrinting()

Re-running the report

The report displayed in the report viewer is automatically re-run when the report is printed or exported from the report viewer. The WLanguage events associated with report are re-run.
In this case, the data displayed in the report may be modified (to take into account the data modified by the other users for example).
The variables used by the report should be initialized in the report initialization code (not in the code of the Button control that starts the report viewer).
Remark: The WLanguage functions used in your report may return a different result when the report is re-run. For example, if WLanguage functions in your report handle the current window, when the report is re-run, the current window will correspond to the report viewer window.
Business / UI classification: Neutral code
Component: wd300prn.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 12/08/2023

Send a report | Local help