Promotic

Print - method of the PmaPanel object

Description:
Print the panel (or its part) to a printer or into the file.
Syntax:
Boolean Print([Long nAttr], [String sOptions], [String sParams])
Parameters:
nAttr[optional] (Long) Parameter specifies whether the panel will be printed
0 (default) - by new method
1 - by old method
sOptions[optional] (String) Additional parameters that define the way of printing (crop, etc.). If not set, then the whole panel is printed with default settting. The value of the sOptions parameter is taken also from the static default object setting, see sFramePars default value. Entries are in the KeyVal format, for example "x:0;y:0;dx:300;dy:200;printer:select;printzoom:0;".
"x:nn;" (optional) - x-position of the left upper corner of the cutout (in pixels, default 0).
"y:nn;" (optional) - y-position of the left upper corner of the cutout (in pixels, default 0).
"dx:nn;" (optional) - Size of the x-crop (in pixels, default 0 = the whole panel).
"dy:nn;" (optional) - Size of the y-crop (in pixels, default 0 = the whole panel).
"printer:xx;" (optional) - It allows to select and configure the printer.
select (default) - The system window will be displayed for printer setup.
default - Print will be executed on default OS Windows printer.
file:filepath - The file name with the path (*.bmp, *.png, *.jpg, *.gif or *.tif), where the panel or its portion will be saved. The file extension specifies the graphic format. It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders. The resulting size of the image in the file is determined by the size of the panel or the selected portion.
"printzoom:nn;" (optional) - The resulting size of the image in the file is determined by the size of the panel or the selected portion.
sParams[optional] (String) It allows to set the value of parameters of the PmgRoot object.
This parameter is then accessible in the panel configurators by means of the Macro expression $.par and in the script by the GetPar method.
Each parameter here consists of an identifier (name) and a value.
Syntax: "pars:{name1:value1;name2:value2; ...}".
See also: Parameters of the Pmg object.
The value of the sParams parameter is taken from the default static object setting. See sViewPars default value.
Note:
If this method is called over the panel that is not open then the panel is opened invisibly and then it is closed after printing is finished. During this process the onOpen and onClose events are not activated.

This method is not functional in Web panels. it is better to use the PmgRoot.Print method.
Example1:
Print the whole panel. The panel will be stretched to the size of the paper (aspect ratio kept) and printer selection and setup window will be displayed.
JavaScriptVBScriptSelect and copy to clipboard

var b = pMe.Pm("/panel").Print();
Example2:
Print the cutout of the panel, where the cutout begins on the position 100,100 and its size is 300,200. The panel will be stretched to the size of the paper (aspect ratio kept) and printer selection and setup window will be displayed.
JavaScriptVBScriptSelect and copy to clipboard

var b = pMe.Pm("/panel").Print(0, "x:100;y:100;dx:300;dy:200;");
Example3:
Print the whole panel into the #temp:Img/panel.png; file. The resulting size of the image in the file is determined by the size of the panel or the selected portion.
JavaScriptVBScriptSelect and copy to clipboard

var b = pMe.Pm("/panel").Print(0, "printer:file:#temp:Img/panel.png;");
Example4:
Print into file specified by an absolute path.
JavaScriptVBScriptSelect and copy to clipboard

var b = pMe.Pm("/panel").Print(0, "printer:file:c:/Imges/panel.png;");
PROMOTIC 9.0.17 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice