Description
Prints the contents of the specified window or frame using the current printing settings.
This method is part of the basic freely-distributable printing subset.
However, the acquisition of a MeadCo Publishing License means that you can customize various printing properties such as copies, duplex, paperSize, printBackground etc., target a specific printer or print externally-located documents with PrintHTML. See HTML Printing with ScriptX for more info.
Syntax
bResult = printing.Print([prompt[, frameOrWindow]])
Returns false if printing with a prompt and the user cancels the printing.
Parameter | Description |
---|---|
prompt | [Optional] (Bool) whether or not to prompt. Ignored in the Internet Zone unless a Publishing License is available. |
frameOrWindow | [Optional] (Object or String) HTML frame (within the containing page that hosts the ScriptX object) to print; either an object or the frame's (String) identifier. By default, the containing page that hosts the ScriptX object will be printed. |
Please note that for promptless printing to work in the Internet Zone a Publishing License is required. This is done to prevent anonymous Internet content invoking printing without a prompt.
Example
The following simple but complete example shows how to print the containing page:
<head>
<title>MeadCo's ScriptX: Print</title>
<!-- special style sheet for printing -->
<style media="print">
.noprint {
display: none
}
</style>
</head>
<body scroll="auto">
<!-- MeadCo Security Manager - using evaluation license -->
<object viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
codebase="smsx.cab#Version=8,3,0,4">
<param name="GUID" value="{3cfd70e2-f38f-4ab2-95f4-4ce4c1e39497}">
<param name="Path" value="sxlic.mlf">
<param name="Revision" value="0">
</object>
<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>
<script defer>
function window.onload() {
factory.printing.header = "MeadCo's ScriptX: Print";
factory.printing.footer = "The de facto standard for advanced web-based printing";
factory.printing.portrait = false;
idPrint.disabled = false; // enable UI button
}
function Print() {
factory.printing.Print(false); // no prompt
}
</script>
<p>Hello, world!</p>
<div class="noprint">
<hr>The button itself will not be printed:
<input id=idPrint disabled type="button" value="Print w/o prompt" onclick="Print()">
</div>
</body>