Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PrintHtmlPage - method of object Pm

Description:
Print or display the preview of the HTML page or text.
Syntax:
PrintHtmlPage(sHtml As String, sOptions As String)
Calling:
Pm.PrintHtmlPage sHtml, sOption
Parameters:
sHtml(String) Definition of HTML page (or source of text, image, etc.). It can be defined variously (according to the sourcetype setting):
- URL address, see Example1.
- The file name with the path, see Example2 and Example3.
- The source content of the HTML page, see Example5 and Example6.
- Text content, see Example4.
sOptions(String) Additional parameters Entries are in format PmNamedValues, for example "sourcetype:url;printer:select;".
"sourcetype:xxx;" (mandatory) - Defines the meaning of the sHtml parameter
htmlstring - In sHtml, there is the content of the HTML page.
textstring - In sHtml, there is the content of the TXT page. It means that in this case it is not a HTML text, but ordinary unformated text (for example in *.txt file).
file - In sHtml, there is the path to a file on the disc. See PROMOTIC path to files and folders.
url - In sHtml, there is the URL address. It is passed to Internet Explorerwith no modification. It should contain also the prefix (http://, file:// ..)
"printer:xxx;" (optional) - Defining the printer.
select (default) - Printing with the option of selecting the printer and changing the setting (orientation, resolution, etc.) by using the input window.
default - Printing with the OS Windows default printer (no input window). The default printer settings cannot be modified (orientation, resolution, etc.).
preview - Displaying the print preview with the option of changing the setting (orientation, resolution, etc.).
"width:xxx;" (optional) - The width of the source page before printing. The width and height are usually optional because the content adapts to the printed page.
"height:xxx;" (optional) - The height of the source page before printing.
Note:
The method can also be called in the graphic item events for Web panels. It means that it is possible to print also in Web client, with following limitations:
- sourcetype:file; is not functional
- printer:default; is not functional (the query for printer is always carried out, the same way as for printer:select; setting)
Example1:
Printing the content of an url adress with the option to choose and configure the printer.
JavaScriptVBScriptSelect and copy to clipboard

Pm.PrintHtmlPage("https://www.promotic.eu", "sourcetype:url;printer:select;");
Example2:
Printing a text file.
JavaScriptVBScriptSelect and copy to clipboard

Pm.PrintHtmlPage("#app:Log.txt", "sourcetype:file;printer:default;");
Example3:
Printing image file.
JavaScriptVBScriptSelect and copy to clipboard

Pm.PrintHtmlPage("#appres:Image.png", "sourcetype:file;printer:default;");
Example4:
Printing the content of text variable
VBScriptSelect and copy to clipboard

Dim sString
sString = Pm.FileTextRead("#data:file.txt", 0)
Pm.PrintHtmlPage sString, "sourcetype:textstring;printer:default;"
Example5:
Preview before printing the PmReport object
VBScriptSelect and copy to clipboard

Dim oReport
Set oReport = pMe.Pm("/Reports/Report1")
Pm.PrintHtmlPage oReport.SaveToString(""), "sourcetype:htmlstring;printer:preview;"
Example6:
Printing from the variable filled with the ActiveX TrendsView print page on the default OS Windows printer with the option to set the dimensions of the page.
JavaScriptVBScriptSelect and copy to clipboard

var sHtml = oTView.SaveToHtm("ver:1", "return:", "mode:graph;");
Pm.PrintHtmlPage(sHtml, "sourcetype:htmlstring;printer:preview;width:700px;height:930px;");
PROMOTIC 8.3.22 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- PrintHtmlPage
 
 
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice