PrintWindow
- Last UpdatedOct 29, 2026
- 2 minute read
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 |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
PrintWindow |
Graphic |
Asynchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Not supported |
Syntax
PrintWindow(strScreenName,optNumOrientation,optNumID,optStrMnemonicList)
strScreenName
The name of the screen to be printed. If this parameter is omitted, then the currently active screen will be printed.
This parameter should 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.
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.
Return value
This function does not support printing to Studio PDF2. (Studio PDF2 is a PDF printer that is installed with Edge HMI for use with other features such as the PDFCreate function.) If Studio PDF2 is selected as the printer on the computer or device where this function is executed, the specified screen is not printed and this function returns -1.
Otherwise, this function returns no value.
Notes
If the Enforce Web functionality equivalence in local project screens option is selected in the project settings, this function cannot be called in VBScript Global Procedures, VBScript scripts (script groups), or other background tasks. This is because the function behaves differently depending on whether you view project screens locally (that is, on the same computer that hosts the project runtime) or remotely. 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.