PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Creating a watermark from the print preview
  • Customizing the preview window
  • Creating a watermark by programming
  • Method 1: Full configuration: using a Watermark variable
  • Method 2: Quick configuration: direct use
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
A report (and a duplicate copy) can include an additional text in the format of a watermark, such as "Confidential" or "Duplicate" printed across the report.
The watermark can be created:
  • from the print preview (WINDEV only).
  • by programming.
Notes:
  • If a watermark is defined for a report, it is defined for all the pages of the report.
  • A single watermark can be defined for each report. You cannot define several watermarks.
  • The watermark is printed on the pages containing information only. It is not printed on empty pages.
Creating a watermark from the print preview
WINDEVReports and Queries The print preview proposes a button ( Watermark icon available in the preview ) allowing the user to create a watermark in the report currently displayed.
When using this button, a specific window allows the user to define:
On the "Annotate" pane of the print preview, the "Watermark" option allows the user to create a watermark in the report currently displayed.
When selecting this option, a specific window allows the user to define:
  • the destination of the watermark: print and/or duplicate copy.
  • the positioning of the watermark: ascending diagonal, descending diagonal or horizontal.
  • the text of the watermark, its font, its size, its color and its opacity.
    Entering the watermark in the preview
WINDEVReports and Queries

Customizing the preview window

If the preview window was customized (before displaying the watermarks), to manage the watermarks, you must:
  1. Import the new preview window.
  2. Copy the button for creating watermarks.
See Customizing the preview window for more details.
Creating a watermark by programming
Different methods can be used to create a watermark by programming:
  • Method 1: Full configuration: using a Watermark variable
  • Method 2: Quick configuration: direct use (syntax available from version 170069)Method 2: Quick configuration: direct use

Method 1: Full configuration: using a Watermark variable

This method is as follows:
  1. Define a Watermark variable. This variable contains all the characteristics of the watermark to print.
  2. Use iParameterWatermark to add the watermark into your report.
  3. Start printing the report.
For example:
  • Code used to print a watermark in background of a report created with the report editor:
    // Print a watermark in report background
    MyWatermark is Watermark

    // Text of the watermark
    MyWatermark..Text = "Confidential"
    // Font used
    MyWatermark..Font..Name = "Arial"
    // The watermark will be horizontally centered at bottom
    MyWatermark..Position = iCenterH + iBottom

    // Print preview
    iPreview()

    // Indicates that the watermark will be printed during the print
    // and in the duplicate copies
    iParameterWatermark(iWatermarkPrinting + ...
    iWatermarkDuplicate, MyWatermark)

    // Starts printing the report
    iPrintReport(RPT_Commercial)
  • Code used to print a watermark in background of a report created with the print functions:
    MyWatermark is Watermark

    // Text of the watermark
    MyWatermark..Text = "Confidential"

    // Print preview
    iPreview()

    // Implement a watermark in document background only
    iParameterWatermark(iWatermarkPrinting, MyWatermark)

    // Prints several pages with watermark
    FOR i = 6 TO 10
    iPrint(" Page " + i)
    iSkipPage()
    END
    // The last page is empty and it has no watermark

    // Ends the print
    iEndPrinting()

Method 2: Quick configuration: direct use

This method is as follows:
  1. Use iParameterWatermark to specify the text of the watermark that will be added into your report. In this case, the "Arial" font is used, with an automatic size and with an opacity set to 20%.
  2. Start printing the report.
For example:
  • Code used to print a watermark in background of a report created with the report editor:
    // Print preview
    iPreview()

    // Indicates that the watermark will be printed during the print
    // and in the duplicate copies
    iParameterWatermark("Confidential")

    // Starts printing the report
    iPrintReport(RPT_Commercial)
  • Code used to print a watermark in background of a report created with the print functions:
    // Print preview
    iPreview()

    // Implement a watermark in document background only
    iParameterWatermark(iWatermarkPrinting, "Confidential")

    // Prints several pages with watermark
    FOR i = 6 TO 10
    iPrint(" Page " + i)
    iSkipPage()
    END
    // The last page is empty and it has no watermark

    // Ends the print
    iEndPrinting()
Related Examples:
WD Reports Training (WINDEV): WD Reports
[ + ] This example presents the different methods for creating a report:

- prints based on different data sources (queries, variables, ...)
- prints based on controls (Table, Spreadsheet, PVT, ...)
- printing composite reports
- specific prints (portrait/landscape, report with watermark, report with bar code, ...)
Minimum required version
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment