PrintWindow

The function PrintWindow prints a screenshot of a project screen. The screen does not need to be open and active; the function can print a screen running in the background or even closed screen file.

Function Group Execution Windows Embedded Thin Client Mobile Access
PrintWindow Graphic Asynchronous Supported Supported Supported Not supported

Syntax

  PrintWindow(strScreenName,optNumOrientation,optNumID,optStrMnemonicList)  
Web Studio Help unction graphic printwindow.xml d137068e111 PrintWindow
strScreenName
The name of the screen to be printed. If this parameter is omitted, then the currently active screen will be printed. (This parameter must be omitted when executing the function on a Windows Embedded target system.)
optNumOrientation
A numeric flag specifying the print orientation:
Value Description
0 Portrait
1 Landscape

This parameter is optional; if no value is specified, the default value is 0.

Note: This parameter is not supported in projects running on Windows Embedded target systems.
optNumID
The specific ID number of the screen. (This number is assigned when the screen is opened using the function Open.)

This parameter is optional; if no value is specified, the default value is 0.

optStrMnemonicList
A string that describes how the custom properties of any generic objects or linked symbols in the screen will be completed when the screen is printed. This string has the following syntax…
  #Label:Value  

…where Label is the name of the property and Value is the tag, expression or literal value that the property will receive. You can declare two or more mnemonics, as long as they are separated by spaces. See the Examples section below for an example.

Note: This parameter does not work for a screen that is already open, because if the screen has been opened, the custom properties have received their values.

Returned value

This function does not return any value.

Notes

If the option Enforce Web functionality equivalence is selected in the project settings, this function cannot be called from Global Procedures or Script worksheets. This is because the function is meaningful only when it is executed on stations that display project screens; it might cause unexpected behavior if it is called from background tasks that are executed on the project runtime server. For more information, see Preferences tab.

Examples

Print the currently active screen in portrait orientation:
  PrintWindow()  
Print the screen named “Main” in landscape orientation:
  PrintWindow("Main",1)  
Print the screen specified by the tag MyScreenName:
  PrintWindow(MyScreenName)  
Print the screen named “Main” with ID 10:
  PrintWindow("Main",1,10)  
Print the screen named “Main”, replacing the custom properties Mne1 and Mne2 with the values of Tag1 and Tag2, respectively:
  PrintWindow("Main",1,0,"#Mne1:Tag1 #Mne2:Tag2")  
Tip: You can use this function to print graphical reports that include Alarm/Event Control and Trend Control objects.

PrintWindow