Print
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 specific printer or print externally-located documents with PrintHTML. See HTML Printing with ScriptX for more info.
Syntax
printing.Print([prompt[, frameOrWindow]])
Parameter |
Description |
prompt |
(Bool) whether or not to prompt. Ignored in the Internet Zone unless a Publishing License is available. |
frameOrWindow |
(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 ScriptXobject 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.
Return Value
Returns false if printing with a prompt and the user cancels the printing.
Example
Check out the source code of the ScriptX Basic, Advanced and Techie printing examples.
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="{370000ED-D40C-43D4-B3D3-F2E7D2EFF47D}
">
<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>
Applies To
printing
See Also
HTML Printing with ScriptX
bottomMargin, collate, copies, duplex, footer, header, leftMargin, onafterprint, onuserprint, paperSize, paperSource, portrait, printBackground, printer, printToFileName, rightMargin, templateURL, topMargin
DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, GetMarginMeasure, IsSpooling, IsTemplateSupported, OwnQueue, PageSetup, Preview, Print, PrintHTML, PrintPDF, PrintSetup, PrintXML, SetMarginMeasure, SetPageRange, WaitForSpoolingComplete