- 浏览: 103512 次
- 性别:
- 来自: 南京
文章分类
最新评论
ScriptX printing: technical manual
September 2007 (Version 6.3.435 and later)
Contents
Client-side (within Internet Explorer) Basic functionality: smsx.cab Advanced functionality: smsx.cab How to check whether or not the object is properly installed Testing your print-outs Server-side deployment Within a desktop application
Overview
Introduction
MeadCo's ScriptX is a suite of ActiveX technology components designed to provide absolute control over document printing operations from client and server computers running the Microsoft Windows Web Browsing Platform.
Part of its purpose is to ensure the consistent formatting and appearance of printed output from any local or networked printer, regardless of the printing attributes already set in that computer's Internet Explorer (IE) browser. ScriptX applies a document author's desired attributes at the time of printing browser window or framed content, but thereafter automatically restores all default settings and makes no other permanent changes.
ScriptX 1.0 was introduced by MeadCo in 1998 as a freely distributable utility offering a limited set of print formatting functionality - the scripted control of the printing of HTML frame or window content (with or without a prompt), and the specification by script of printing parameters such as page headers, footers, margins and paper orientation within IE.
That basic functionality is still available at no charge and is freely distributable. Features that are part of that 'free' printing subset are marked in this document as basic.
With the releases of later versions, significantly more advanced printing functionality was introduced which is only accessible in the presence of a paid-for MeadCo publishing license?/span>.
Target platform
ScriptX has been tested on and supports Microsoft Windows Web Browsing Platform versions 4.01 SP1 - 7.0 on all Microsoft Windows Win32 OS platforms (including Vista) with the exception of Windows NT 3.51.
Product credits
ScriptX has been widely adopted and acknowledged by the Web and intranet development communities. Check out:
Summary of examples
- Basic
- Illustrates the straightforward use of the freely distributable ScriptX basic printing functionality: headers, footers, margins and paper orientation.
-
Advanced - Illustrates the typical use of ScriptX advanced printing functionality for which a publishing license is required.
-
Techie - An all-in-one technical example illustrating the most advanced use of licensed ScriptX functionality.
- Printer Control
- Illustrates the use of the printerControl, Jobs and Job objects.
- Printing reports and customised documents
- Provides a discussion of printing customised documents and reports with ScriptX and a number of samples of differing techniques. A download of all the sample code is included.
Feel free to investigate the source code from any of the examples and to cut & paste fragments into your own applications.
Advanced control of HTML Printing with ScriptX
Advanced printing functionality can only be used with a paid-for publishing license. Some of the advanced features enabled with a license are:
-
Control over the printing of a document's background color and images (printBackground).
-
A SetMarginMeasure method to ensure that the chosen unit of measure for margins (inches or millimeters) will be consistent across machines with different locale settings.
-
Facilities to select a non-default printer, paper size & source, page range & collation and number of copies to print.
-
Custom Print Templates can be deployed (templateURL) in IE5.5 and later. Read more about MeadCo's in-depth support for Print Templates here.
-
Reliability and scalability. The PrintHTML(url) method can queue and print any number of documents without compromising system performance. This is especially important for server side printing. On the client side, PrintHTML works in the HTTP session context of the calling page (SSL is supported as well).
-
Precise tracking of spooler activity (IsSpooling, WaitForSpoolingComplete, onafterprint). By default, when the Internet Explorer window is closed or the page navigated away from whilst a print-out is still being spooled, the user will be prompted. The prompt can be customized or disabled (onbeforeunload).
-
Print settings changes (headersbasic, footersbasic, marginsbasic, paper orientationbasic, printer name, paper size, paper source, page range selection, number of copies, collation, duplex mode) once made from script now become active for Internet Explorer's native UI Print... and Page Setup... commands, as well as for the native window.print()?/span> script method, during the time that the document is displayed. Now an author doesn't need to put a [Print] button on an HTML page.
-
Internet Explorer's native printing UI can now be trapped and cancelled, or handled in a particular way (disableUI, onuserprint, onuserpreview, onuserpagesetup). A document's DHTML user interface can also be updated in response to user changes in the Page Setup and Print dialogs (onpagesetup). See the Techie printing example for an illustration of UI handling.
-
All changes made to print settings affect only the current document and are automatically restored upon navigation, or when the window is closed.
-
A redirect of raw print-out data can be made to a specified file name (printToFileName).
-
Basic printing of Microsoft Officetm and Adobe Acrobattm documents.
-
Batch printing of PDF and MS Office documents (BatchPrintPDF).
Backwards compatibility
All releases of ScriptX are fully backwards compatible with previous releases and for advanced functionality will work with all existing publishing licenses. ScriptX works in close concert with the Microsoft Windows Web Browsing Platform and as a result is updated to work with all latest releases and patches. All code updates are free; there is never a charge for obtaining the latest code.
We strongly recommend that you update your <OBJECT> elements to reference the current version 6,3,435,20 and update smsx.cab (and replace ScriptX.cab with smsx.cab) on your servers.
-
An important compatibility issue is that ScriptX printing will now always prompt when called in the context of Internet Explorer's Internet Security Zone (check the zone icon in the browser's status bar). This is done to prevent anonymous Internet content invoking printing without a prompt (see PRB: Printing with WebBrowser from Internet Explorer Raises Print Dialog Box in Internet Explorer 5?/span>).
For the My Computer, Local Intranet and Trusted Sites Security Zones promptless printing will work. If you need promptless printing for the Internet Security Zone, you should obtain a publishing license that will bind the deployment of ScriptX to the URL addresses from which you want to serve ScriptX-enabled content. - Another important note concerns margin units of measure (inches and millimeters). By default ScriptX uses the units of measure set on the client machine. This is OK when pages are being authored for a known environment such as a small corporate intranet where all Regional Settings are identical, but in a broader environment users' Number settings are certain to vary. So an author should specify the SetMarginMeasure methodwith a value of either 1 (mm) or 2 (inches). ScriptX will then print to the margins specified regardless of -- and without affecting -- a user's default Regional Number Settings.
What's New
v6.2
Version 6.2 introduces the printerControl, Jobs and Job objects to provide detailed information about the available printers and control of the print queue for a printer. The use of methods that control the print queue requires that the user has administrator rights on the printer.
Also included in this version is an extension of the MeadCo licensing scheme to provide a usable distribution model and allow the use of ScriptX within desktop applications.
v6.3
Version 6.3 provides support for Internet Explorer 7 on Windows XP and Windows Vista; v6.3 is required on the IE 7 platform ... previous versions of ScriptX are not compatible.
This release includes a new print template that provides the same functionality as that within Internet Explorer 7 - scale to fit printing by default and enhanced print preview with draggable margins and switchable headers. This template is available for all versions of Internet Explorer from v5.5 so, whilst your users may be running anything from IE 5.5 onwards, you can give them all a consistent print experience.
The use of the new template is optional - by default ScriptX will use the default template for the platform (IE5.5 style on IE 5.5/IE 6 and IE 7 style on IE7. The particular template required can be specified in script using the templateUrl property or may be specified as a parameter to the ScriptX object.
Frames can now be previewed. This was a MaxiPT only feature but is now also included in the Advanced licensed feature set for ScriptX.
A code review has been undertaken with this release, with APIs checked for behaviour and consistency. This has resulted in some cases where in previous releases a property/method would not report an error when an error occurred - errors are now reported. This may necessitate changes to script code if it was assumed that code would run without error.
v6.3.5
From version 6,3,435,20 onwards ScriptX comes in a single signed CAB - smsx.cab. In addition to fixes for a number of issues, this release introduces improvements for application licenses and the ability to install license updates without requesting permission from the user (this will only occur for updates of an already accepted license).
Two new methods are introduced to provide additional control over the behaviour of the new IE 7 style template. These methods require a publishing license:
- SetPreviewZoom - provides control over the zoom factor used on print preview.
- SetPrintScale - provides control over the scaling used when printing.
Finally, a number of problems have been resolved. A development history, as well as latest test versions of ScriptX is available on the ScriptX Beta page.
How do I use the ScriptX object?
Before reading further, please have a look at our illustrative Basic, Advanced and Techie examples of ScriptX printing to get an idea of what ScriptX can do for you.
There are three scenarios in which ScriptX provides the solution for printing of HTML documents with the Microsoft Windows Web Browsing Platform:
- Within the Internet Explorer browser, on client-side HTML or XML pages. Here, ScriptX provides full scripted control of the printing experience within IE, allowing choosing the output printer, orientation, page header and footers etc and the initiation of the print. ScriptX is ideal for deployment within web applications hosted within Internet Explorer.
- On the server, where ScriptX performs as part of server side request processing, printing an html document loaded from the same or different server.
- As part of a desktop application, ScriptX can be used to print HTML documents from the file system, a web server or generated as an 'inline' string.
Note that the use of ScriptX on the server always requires a license. All licenses are available (on request to feedback@meadroid.com) for a trial period to enable full and proper evaluation of the suitability of ScriptX for a particular usage.
Client-side deployment within Internet Explorer.
ScriptX is deployed as a client-side ActiveX control, instantiated and scripted on an HTML or XML page as an <OBJECT> element?/span>. Download and installation is a one-time client-side event and is handled automatically by the standard Internet Explorer Component Download?/span> technology.
The end user's system must have the "Download Signed ActiveX Controls" and "Script ActiveX control marked as safe for scripting" security settings enabled for the corresponding Security Zone. These are the default settings for the My Computer, Local Intranet, Trusted Sites and Internet Security Zones.
In addition, on Windows 2000 systems and later, the user must be logged on as an Adminsitrator/Power User with the ability to write to the HKEY_LOCAL_MACHINE registry hive and the Windows system folder (typically c:/windows/system32).
If these conditions cannot be met, we suggest you review the Zeepe framework. The Zeepe framework includes ScriptX but is installed via Microsoft Windows Installer technology allowing the components to be installed by users or controlled as part of Corporate software distribution policies. Please note that the ScriptX software included with Zeepe is the same as the stand-alone product, but the ClsIds are changed. An option to only install the ScriptX components of the Zeepe framework is also available - i.e. installation of ScriptX via Windows Installer.
From version 6,3,435,20 onwards ScriptX comes in a single signed CAB - smsx.cab - which is part of a download package obtainable from the ScriptX site. The CAB file should be placed on the web server and its location should be referenced by the CODEBASE?/span> attribute of the <OBJECT> tag, as shown below.
NOTE: In your own code, we recommend that you place the ScriptX <OBJECT> elements in the document's <BODY> container.
-
Make sure that you provide the correct relative or fully-qualified path to the CAB file and the correct version info (6,3,435,20) in your CODEBASE?/span> attributes.
-
Start to script the ScriptX object only when the page is fully loaded i.e. once the window.onload?/span> event has occured.
-
Use the defer?/span> attribute where appropriate in your scripts: <SCRIPT defer>...<SCRIPT> and avoid immediate script statements (i.e. code which is outside of any function scope). This is an under-appreciated but very useful feature which instructs the script to execute only when the whole document's DHTML content is completely parsed. This way you can be sure of accessing every element on the page.
The following code snippets assumes that smsx.cab exists in the same folder as the hosting page itself.
Basic functionality:
<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,3,435,20"> </object>
The Basic printing example illustrates the use of the basic printing subset.
The viewastext attribute prevents an authoring tool such as Microsoft FrontPagetm or Visual InterDevtm from running the object at design time.
NOTE: with the 'basic' subset, you can only script header, footer, page margins, paper orientation, Print and PageSetup methods and properties.
Specifying a template (e.g. IE 7)
With version 6.3 and later, you may specify the template to use; this is particularly useful when wishing to provide the Internet Explorer style template (default scaled to fit printing) to users with IE 5.5/6.0 browsers or when specifying the use of the MaxiPT template.
<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,3,435,20"> <param name="template" value="MeadCo://IE7" /> </object>
The ability to specify a particular in-built template is included in the 'basic' subset.
Advanced functionality:
<!-- MeadCo Security Manager --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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>
NOTE: the {232E61C9-1E90-4657-AEDB-6F02F3B2EE37} value of the GUID parameter used above identifies the MeadCo evaluation license that authors may use to experiment with Advanced printing capabilities. The license validates local filesystem (file://) and local website (http://localhost/) content for evaluation purposes only on a single development computer.
The evaluation license is periodic. It will expire in a few months and will be replaced by a new one with a different GUID, so any code depending on the evaluation license may suddenly stop working at any time.
Registered customers are issued with an unique license identifier and a digitally signed sxlic.mlf license file. See the licensing?/span> page for more details.
Check out the sources of the Advanced and Techie printing examples for a complete illustration of how to use licensed ScriptX functionality. The following JScript code snippet shows how to modify printing settings so as to print to a specific printer:
<script defer> function SetPrintSettings() { // -- advanced features factory.printing.SetMarginMeasure(2); // measure margins in inches factory.printing.printer = "HP DeskJet 870C"; factory.printing.paperSize = "A4"; factory.printing.paperSource = "Manual feed"; factory.printing.collate = true; factory.printing.copies = 2; factory.printing.SetPageRange(false, 1, 3); // need pages from 1 to 3 // -- basic features factory.printing.header = "This is MeadCo"; factory.printing.footer = "Advanced Printing by ScriptX"; factory.printing.portrait = false; factory.printing.leftMargin = 1.0; factory.printing.topMargin = 1.0; factory.printing.rightMargin = 1.0; factory.printing.bottomMargin = 1.0; } function Print(frame) { factory.printing.Print(true, frame) // print with prompt } </script>
A subtle JScript syntax issue may occur when setting a printer name that contains back slashes. Don't forget to double the slashes:
factory.printing.printer = "////FS-LYS-01//HP5n-759" // print to //FS-LYS-01/HP5n-759
How to check whether or not the object is properly installed
Upon the window.onload?/span> event, test whether or not the object?/span> property of the ScriptX or the Security Manager object returns as a valid object. The way to do that is shown in the script snippet below.
In the event that you experience any problems with automatic client-side download and installation, check out HOWTO: Find More Information About Why Code Download Failed?/span> and Description of Internet Explorer Security Zones Registry Entries?/span> as part of your troubleshooting.
<!-- MeadCo Security Manager - using the evaluation license --> <object id="secmgr" viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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() { if ( !factory.object ) { alert("MeadCo's ScriptX Control is not properly installed!"); navigate("scriptx-install-error.htm"); return; } if ( !secmgr.object ) { alert("MeadCo's Security Manager Control is not properly installed!"); navigate("secmgr-install-error.htm"); return; } if ( !secmgr.validLicense ) { alert("The MeadCo Publishing License is invalid or has been declined by the user!"); navigate("license-error.htm"); return; } alert("Ready to script MeadCo's ScriptX!") } </script>
Testing your print-outs
The development and testing of code to produce good-looking printed reports usually takes a number of iterations. To save toner, paper, trees and our own precious time :-) we regularly use the FinePrinttm?/span> application from FinePrint Software.
FinePrinttm installs a virtual printer driver that serves as indirection layer between the printing application (Internet Explorer in our case) and a physical or networked printer. In 'bypass' mode it lets us accurately preview and repaginate ScriptX-enabled content before it is actually printed or discarded.
It's also a very handy testing device with which to diagnose printing problems. So because we are physically unable to test ScriptX with every model and version of printer and printer driver that exists in the world, we would greatly appreciate it if you would try printing to the FinePrint driver before reporting errors against ScriptX from your particular printing environment.
NOTE: Mead & Co Limited has no commercial affiliation with FinePrint Software, LLC.
Technical support
Licensees of ScriptX' advanced printing functionality are entitled to unlimited direct-to-company email support and access to new versions of the ScriptX software as-and-when issued, both at no additional charge.
Please send us feedback & bug reports.
Web support links
Microsoft Internet Explorer printing and Internet Explorer Component Download support articles:
INFO: WebCast: How Does Internet Component Download Work??/span>
HOWTO: Find More Information About Why Code Download Failed?/span>
PRB: Trust Provider Warning Message Appears When You Attempt to Download Components?/span>
PROBLEM: Blank Page Is Printed in Internet Explorer 5.5?/span>
General information on Internet Explorer printing:
Beyond Print Preview: Print Customization for Internet Explorer 5.5?/span>
Print Preview 2: The Continuing Adventures of Internet Explorer 5.5 Print Customization?/span>
Print Template Reference?/span>
Style Sheets and Printing?/span>
Inside Technique : Printing Techniques?/span>
Printing Tables on Multiple Pages?/span>
INFO: Page Break Styles Supported Only with Block Elements?/span>
ScriptX printing: technical reference
Unless otherwise indicated by the basic icon, the use of any property or method requires a publishing license?/span>.
Objects
Bins, Forms, factory, printing, printerControl, Jobs, Job
Properties
bottomMargin, collate, copies, currentPrinter, disableUI, duplex, footer, header, leftMargin, onafterprint, onbeforeunload, onpagesetup, onuserpagesetup, onuserprint, onuserprintpreview, pageHeight, pageWidth, paperSize, paperSource, portrait, printBackground, printer, printToFileName, rightMargin, templateURL, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
Methods and Functions
BatchPrintPDF, DefaultPrinter, DoPrint, EnumJobs, EnumPrinters, GetJobsCount, GetMarginMeasure, IsSpooling, IsTemplateSupported, OwnQueue, PageSetup, Preview, Print, PrintHTML, PrintPDF, PrintSetup, PrintXML, SetMarginMeasure, SetPageRange, SetPrintScale, SetPreviewZoom, Sleep, WaitForSpoolingComplete
Objects
Bins
Description
Lists the available paper sources for a printer. The object is a collection (it can be passed to the JScript Enumerator method or used in a VBScript for..each loop).
The names returned are suitable for use with the paperSource property.
Syntax
oJobs = printerControl.Bins
Properties
Item(nIndex) - returns the name of the paper source item at nIndex
Count - returns the number of available paper sources.
Methods
None.
Example
<script defer> function listBins() { var j = factory.printing.printerControl(factory.printing.DefaultPrinter()).Bins; var e = new Enumerator(j); var s = ""; while ( !e.atEnd() ) { if ( s.length > 0 ) s+="/n"; s += e.item(0); e.moveNext(); } alert("There are " + j.Count + " available sources:/n/n" + s); } <script>
Applies To
See Also
Forms
Description
Lists the available paper sizes (forms) for a printer. The object is a collection (it can be passed to the JScript Enumerator method or used in a VBScript for..each loop).
The names returned are suitable for use with the paperSize property.
Syntax
oJobs = printerControl.Forms
Properties
Item(nIndex) - returns the name of the paper at nIndex
Count - returns the number of available paper sizes.
Methods
None.
Example
<script defer> function listForms() { var j = factory.printing.printerControl(factory.printing.DefaultPrinter()).Forms; var e = new Enumerator(j); var s = ""; while ( !e.atEnd() ) { if ( s.length > 0 ) s+="/n"; s += e.item(0); e.moveNext(); } alert("There are " + j.Count + " available paper sizes:/n/n" + s); } <script>
Applies To
See Also
factory
Description
Represents the ScriptX object itself on an HTML page for scripting by its id . For historical reasons, we name it factory.
For WSH or ASP (i.e. server-side) use only, create a ScriptX instance dynamically with the JScript new ActiveXObject?/span> or the VBScript CreateObject?/span>.
Note that you can not use CreateObject or new ActiveXObject to call ScriptX client-side. You should call ScriptX in all client-side cases by the id of the on-page ScriptX object.
See How do I use the ScriptX object for deployment details.
Examples
HTML page:
<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,3,435,20"> </object>WSH?/span> script (JScript):
var factory = new ActiveXObject("ScriptX.Factory") factory.printing.PrintHTML("http://msdn.microsoft.com/workshop/author/script/dhtmlprint.asp")ASP page (VBScript):
<% set factory = CreateObject("ScriptX.Factory") factory.printing.PrintHTML "http://localhost/orders/order.asp?number=" & Request.Form("number") set factory = nothing %>
Properties
Methods
printing
Description
Represents the printing functionality of ScriptX. See HTML Printing with ScriptX for more information and examples.
Syntax
printing = factory.printing
Properties
attributes, bottomMargin, collate, copies, currentPrinter, disableUI, duplex, fontColor, footer, header, isLocal, isNetwork, isShared, Jobs, leftMargin, location, name, onafterprint, onbeforeunload, onpagesetup, onuserpagesetup, onuserprint, onuserprintpreview, pageHeight, pageWidth, paperSize, paperSource, port, portrait, printBackground, printer, printerControl, printToFileName, rightMargin, serverName, shareName, status, templateURL, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
Methods
BatchPrintPDF, CreateFont, Delete, DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, GetMarginMeasure, IsSpooling, IsTemplateSupported, OwnQueue, PageSetup, Pause, Preview, Print, PrintHTML, PrintPDF, PrintSetup, Purge, Restart, Resume, SetMarginMeasure, SetPageRange, ShowChooseFont, Sleep, WaitForSpoolingComplete
Applies To
printerControl
Description
Represents the ability to determine a range of printer properties and control the print queue for the printer. Only the exact printer name strings as they appear on Internet Explorer's Print dialog can be specified. If the string does not exist or is written incorrectly then an error will be thrown (e.g. "The printer name is invalid").
Syntax
oControl = factory.printing.printerControl(sPrinterName)
Properties
attributes, Bins, Forms, isLocal, isNetwork, isShared, Jobs, location, name, port, serverName, shareName, status
Methods
Example
<script defer> function networkServer() { var oControl = factory.printing.printerControl(factory.printing.currentPrinter); if ( oControl.isNetwork ) alert("The current printer is on the network server: " + oControl.serverName); } <script>
Applies To
Jobs
Description
Represents the list of jobs currently in the queue for a printer. The object is a collection (it can be passed to the JScript Enumerator method or used in a VBScript for..each loop).
Syntax
oJobs = printerControl.Jobs
Properties
Item(nIndex) - returns a printJob object for the item at nIndex
Count - returns the number of items in the queue.
Methods
None.
Example
<script defer> function listJobs() { var j = factory.printing.printerControl(factory.printing.DefaultPrinter()).Jobs; var e = new Enumerator(j); alert("There are " + j.Count + " jobs in the queue"); while ( !e.atEnd() ) { alert("Job name: " + e.item().document); e.moveNext(); } } <script>
Applies To
See Also
Job
Description
Represents a single job in the queue for a printer. A job is obtained from the list of print jobs available on a printer.
Syntax
oJob = printerControl.Jobs.Item(nIndex)
Properties
All properties are read only:
Property Descripion document Specifies the name of the print job, typically the title of the html document that has been printed. machineName Specifies the name of the machine that created the print job. pagesPrinted Specifies the number of pages that have printed. This value may be zero if the print job does not contain page delimiting information. position Specifies the job's position in the print queue. printerName Specifies the name of the printer for which the job is spooled. size Specifies the size, in bytes, of the job. status Specifies the job status, can be one or more of the following values:
Meaning Value JOB_STATUS_PAUSED 0x00000001 JOB_STATUS_ERROR 0x00000002 JOB_STATUS_DELETING 0x00000004 JOB_STATUS_SPOOLING 0x00000008 JOB_STATUS_PRINTING 0x00000010 JOB_STATUS_OFFLINE 0x00000020 JOB_STATUS_PAPEROUT 0x00000040 JOB_STATUS_PRINTED 0x00000080 JOB_STATUS_DELETED 0x00000100 JOB_STATUS_BLOCKED_DEVQ 0x00000200 JOB_STATUS_USER_INTERVENTION 0x00000400 JOB_STATUS_RESTART 0x00000800 statusText A string containing a description of the status. This may be provided by the printer driver or may be generated by ScriptX from the value of status. If generated by ScriptX the description is in English only. submittedAt Specifies the time when the job was submitted. totalPages Specifies the number of pages required for the job. This value may be zero if the print job does not contain page delimiting information. userName Specifies the name of the user who owns the print job. The value of all properties are determined at the time that the Jobs collection is created, no properties are dynamic (for example a loop inspecting the value of pagesPrinted will not see the value decrease as might be expected).
Methods
Properties
attributes
Description
Returns the attributes of the printer; can be any reasonable combination of the following values:
Value Meaning PRINTER_ATTRIBUTE_DEFAULT (0x00000004) Windows 95/98/Me: Indicates the printer is the default printer in the system. PRINTER_ATTRIBUTE_DIRECT (0x00000002) Job is sent directly to the printer (it is not spooled). PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST (0x00000200) If set and printer is set for print-while-spooling, any jobs that have completed spooling are scheduled to print before jobs that have not completed spooling. PRINTER_ATTRIBUTE_ENABLE_BIDI (0x00000800) Windows 95/98/Me: Indicates whether bi-directional communications are enabled for the printer. PRINTER_ATTRIBUTE_FAX (0x00004000) Windows XP: If set, printer is a fax printer. PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS (0x00000100) If set, jobs are kept after they are printed. If unset, jobs are deleted. PRINTER_ATTRIBUTE_QUEUED (0x00000001) If set, the printer spools and starts printing after the last page is spooled. If not set and PRINTER_ATTRIBUTE_DIRECT is not set, the printer spools and prints while spooling. PRINTER_ATTRIBUTE_SHARED (0x00000008) Printer is shared. PRINTER_ATTRIBUTE_WORK_OFFLINE (0x00000400) Windows 95/98/Me: Indicates whether the printer is currently connected. If the printer is not currently connected, print jobs will continue to spool. PRINTER_ATTRIBUTE_PUBLISHED (0x00002000) Windows 2000/XP: Indicates whether the printer is published in the directory service. PRINTER_ATTRIBUTE_NETWORK (0x00000010) Printer is a network printer connection. PRINTER_ATTRIBUTE_LOCAL (0x00000040) Printer is a local printer. PRINTER_ATTRIBUTE_RAW_ONLY (0x00001000) Indicates that only raw data type print jobs can be spooled.
Syntax
attributes = printerControl.attributes
Settings
This is a read only property.
Applies To
bottomMarginbasic
Description
Specifies the bottom margin height for HTML print-outs. Cannot be set to be less than the printer's physically unprintable area (unprintableBottom), in which case it will be automatically corrected to the minimum allowed value. If top and bottom margins are set to overlap, they will be corrected to an arbitrary default value of 1/10 of page height.
ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
The bottomMargin property is part of the basic freely-distributable printing subset.
Syntax
printing.bottomMargin = numMargin
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
leftMargin, pageHeight, pageWidth, portrait, rightMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
GetMarginMeasure, PageSetup, Print, PrintHTML, SetMarginMeasure
collate
Description
Specifies whether or not to collate the pages of HTML print-outs when more than one copy is printed.
Syntax
printing.collate = true|false
Settings
This is a read/write property. Use true to collate.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
copies
Description
Specifies the number of copies for HTML print-outs.
Syntax
printing.copies = numCopies
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
currentPrinter
Description
Specifies the printer to print to. Only the exact printer name strings as they appear on Internet Explorer's Print dialog can be specified. If the string does not exist or is written incorrectly, printing will be directed to the default printer.
Syntax
printing.currentPrinter = sPrinterName
Settings
This a read/write property. With JScript, take care to double a backslash if one appears in the printer name, as in the example below.
Usage
The internal implementation of writing to the currentPrinter property is the same as writing to the printer property, other than the implementation of currentPrinter does not 'eat' any error. Therefore an error in currentPrinter will be reported in the same way as any other error that occurs in an ActiveX object property/method call.
Example
factory.printing.currentPrinter = "////FS-LYS-01//HP5n-759" // print to //FS-LYS-01/HP5n-759
Applies To
See Also
printer, EnumJobs, EnumPrinters, GetJobsCount, IsTemplateSupported, Print
disableUI
Description
Set to true to disable all of Internet Explorer's printing facilities, including the File/Page Setup, File/Print main menu commands, the Print context menu command and the window.print() scripting method. Given this, the only way left to print is via the ScriptX Print and PrintHTML methods.
Syntax
printing.disableUI = true|false
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing example.
See Also
onpagesetup, onuserpagesetup, onuserprint, onuserprintpreview
duplex
Description
Duplex mode (if supported by the targeted printer).
Syntax
printing.duplex = number
Settings
This is a read/write property. Use 1 for simplex mode (no duplex), 2 for vertical duplex, 3 for horizontal duplex.
Applies To
See Also
footerbasic
Description
Specifies the string to be used as the footer for HTML print-outs. String can include Internet Explorer header/footer metasymbols. If you need to use HTML for your headers and footers, check MaxiPT 1.0?/span> (Internet Explorer 5.5 or later).
The footer property is part of the basic freely-distributable printing subset.
Syntax
printing.footer = sFooter
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
headerbasic
Description
Specifies the string to be used as the header for HTML print-outs. String can include Internet Explrore header/footer metasymbols. If you need to use HTML for your headers and footers, check MaxiPT 1.0?/span> (Internet Explorer 5.5 or later).
The header property is part of the basic freely-distributable printing subset.
To print specific information as part of the header or footer, include the following characters as part of the string:
Shorthand Meaning &w Window title &u Page address (URL) &d Date in short format (as specified by Regional Settings in Control Panel) &D Date in long format (as specified by Regional Settings in Control Panel) &t Time in the format specified by Regional Settings in Control Panel &T Time in 24-hour format &p Current page number &P Total number of pages && A single ampersand (&) &b The text immediately following these characters as centered. &b&b The text immediately following the first "&b" as centered, and the text following the second "&b" as right-justified.
Syntax
printing.header = sHead
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
isLocal
Description
Returns whether the printer is a local printer (true) or not (false). isLocal tests whether PRINTER_ATTRIBUTE_LOCAL is set in the attributes.
Syntax
bIs = printerControl.isLocal
Settings
This is a read only property.
Applies To
isNetwork
Description
Returns whether the printer is a network printer (true) or not (false). isNetwork tests whether PRINTER_ATTRIBUTE_NETWORK is set in the attributes.
Syntax
bIs = printerControl.isNetwork
Settings
This is a read only property.
Applies To
isShared
Description
Returns whether the printer is a shared printer (true) or not (false). isShared tests whether PRINTER_ATTRIBUTE_SHARED is set in the attributes.
Syntax
bIs = printerControl.isShared
Settings
This is a read only property.
Applies To
leftMarginbasic
Description
Specifies the left margin for HTML print-outs. Cannot be set to be less than the printer's physically unprintable area (unprintableLeft), in which case it will be automatically corrected to the minimum allowed value.If left and right margins overlap, they will be corrected to an arbitrary default value of 1/10 of page width.
ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
The leftMargin property is part of the basic freely-distributable printing subset.
Syntax
printing.leftMargin = numMargin
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
pageHeight, pageWidth, portrait, rightMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
GetMarginMeasure, PageSetup, Print, PrintHTML, SetMarginMeasure
location
Description
Returns a string describing the physical location of the printer.
Syntax
sLoc = printerControl.location
Settings
This is a read only property.
Applies To
name
Description
Returns a string giving the name of the printer.
Syntax
sName = printerControl.name
Settings
This is a read only property.
Applies To
onafterprint
Description
Event handler to be called when print spooling is done. The event is applicable to the results of a Print call but not to that of a PrintHTML call. It can be used to update the user interface accordingly. It is similar to the WaitForSpoolingComplete blocking call, but is asynchronous.Note the difference between ScriptX's onafterprint event and the DHTML window.onafterprint?/span> event: the latter occurs after Internet Explorer has just made a document snapshot for printing and not after the actual print spooling job (see PRB: onafterprint Event Fires Before the Print Dialog Box Appears?/span>). So these two events are not interchangeable.
In fact, the DHTML window.onbeforeprint?/span> and window.onafterprint?/span> exist to give the document's script a chance to customize DHTML content before it goes to print-out or preview (and not to signal actual printing). The same effect can be achieved with the CSS media=print or media=screen specific styles. Check out the following InsideDHTML.com articles: Printing Techniques?/span>, Using CSS to specify alternate document to print out?/span>.
Syntax
printing.onafterprint = function_object
Settings
This is a read/write property.
Applies To
Example
<script defer> factory.printing.onafterprint = AfterPrint; function AfterPrint() { alert("The document has been sent to the print spooler!"); } </script>
See Also
onpagesetup, onuserpagesetup, onuserprint, onuserprintpreview
onbeforeunload
Description
String to prompt a user with when spooling (or a download originated by a PrintHTML call) is still in progress but the page is being closed or navigated away. By default, ScriptX waits 5 seconds in blocking mode to let spooling complete, then prompts the user with the choice to cancel the printing process. The user may decide to wait for another 5 seconds, and so on.Note: to suppress the prompt you can force the blocking wait state with WaitForSpoolingComplete after any Print or PrintHTML call or before leaving the page. However the use of WaitForSpoolingComplete() after each PrintHTML call in a sequence of calls is not recommended. Use it only after the last call in the sequence.
Syntax
printing.onbeforeunload = string
Settings
This is a read/write property.
Applies To
See Also
onpagesetup
Description
Event handler to be called when the current print or page setup settings are changed on the Internet Explorer Page Setup dialog.Use it to update the page's user interface accordingly. This is exactly what the ScriptX Techie Printing example does.
Syntax
printing.onpagesetup = function_object
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
disableUI, onafterprint, onuserpagesetup, onuserprint, onuserprintpreview
onuserpagesetup
Description
Event handler to be called when a user invokes the Page Setup... command from Internet Explorer's File menu.You may cancel this operation within the event handler simply by returning, or you may call PageSetup to provide the expected behavior. In the latter case, once the user has made changes on the Page Setup dialog an onpagesetup event will be fired to update the page's user interface. ScriptX Techie Printing implements this behavior.
Syntax
printing.onuserpagesetup = function_object
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
disableUI, onafterprint, onpagesetup, onuserprint, onuserprintpreview
onuserprint
Description
Event handler to be called when a user invokes the Print... command from the Internet Explorer File menu, or presses Print on the document's right-click context menu, or hits the printer button on the toolbar, or presses the Ctrl-P key combination, or when a script calls window.print()?/span>.You may cancel this operation within the event handler simply by returning, or you may call Print to provide the expected behavior. ScriptX Techie Printing implements this behavior.
Syntax
printing.onuserprint = function_object
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
disableUI, onafterprint, onpagesetup, onuserpagesetup, onuserprintpreview
onuserprintpreview
Description
Event handler to be called when a user invokes the Preview... command from the Internet Explorer File menu or hits the print preview button on the toolbar.You may cancel this operation within the event handler simply by returning, or you may call Preview to provide the expected behavior. ScriptX Techie Printing implements this behavior.
Syntax
printing.onuserprintpreview = function_object
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
disableUI, onafterprint, onpagesetup, onuserpagesetup, onuserprint
pageHeight
Description
Returns the physical height of the current printer paper selection.ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
Syntax
height = printing.pageHeight
Settings
This is a read-only property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
bottomMargin, leftMargin, pageWidth, paperSize, portrait, rightMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
pageWidth
Description
Returns the physical width of the current printer paper selection.ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
Syntax
width = printing.pageWidth
Settings
This is a read-only property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
bottomMargin, leftMargin, pageHeight, paperSize, portrait, rightMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
paperSize
Description
Specifies the paper size for HTML print-outs by its string name. ScriptX tries to find the longest string match amongst the list of available paper size names for the current printer. Read back the paperSize value to see the actual result.
Syntax
printing.paperSize = sPaperSize
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
Forms, pageHeight, pageWidth, paperSource, portrait, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
paperSource
Description
Specifies the paper source (tray) for HTML print-outs by its string name. ScriptX tries to find the longest string match amongst the list of available paper source names for the current printer. Read back the paperSource value to see the actual result.
Syntax
printing.paperSource = sPaperSource
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
port
Description
Returns a string string that identifies the port(s) used to transmit data to the printer. If a printer is connected to more than one port, the names of each port will be separated by commas (for example, "LPT1:,LPT2:,LPT3:").
Windows 95/98/Me: This member can specify only one port because multiple ports per printer are not supported.
Syntax
sName = printerControl.port
Settings
This is a read only property.
Applies To
portraitbasic
Description
Specifies the page orientation for HTML print-outs.
The portrait property is part of the basic freely-distributable printing subset.
Syntax
printing.portrait = true|false
Settings
This is a read/write property. Use true to specify portrait and false for landscape.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, templateURL, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
printBackground
Description
Specifies whether or not to print a page's background colors and images.
Syntax
printing.printBackground = true|false
Settings
This is a write-only property.
Applies To
Example
Check out the source code of the ScriptX Techie Printing example.
See Also
printer
Description
Specifies the printer to print to. Only the exact printer name strings as they appear on Internet Explorer's Print dialog can be specified. If the printer specified does not exist or is written incorrectly, printing will be directed to the default printer.
Syntax
printing.printer = sPrinterName
Settings
This a write-only property. With JScript, take care to double a backslash if one appears in the printer name, as in the example below.
Please note that providing an invalid name will not raise an error - the request will be ignored and the printer to use remain unchanged. To trap errors specifying the printer to use, use the currentPrinter property.
Applies To
Example
factory.printing.printer = "////FS-LYS-01//HP5n-759" // print to //FS-LYS-01/HP5n-759
Also check out the source code of the ScriptX Techie Printing example.
See Also
bottomMargin, collate, copies, currentPrinter, duplex, footer, header, leftMargin, paperSize, paperSource, portrait, printBackground, printToFileName, rightMargin, templateURL, topMargin
DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, IsSpooling, IsTemplateSupported, PrintHTML, PrintSetup, SetPageRange, WaitForSpoolingComplete
printToFileName
Description
The file name to print to. Use the full path specification. The file created doesn't accumulate subsequent print-outs and - for security reasons - doesn't get overwritten if it already exists. Specify a new filename for each new print-out.
Printing to file name is supported for Internet Explorer 5.0 and later.
Syntax
printing.printToFileName = sPathFileName
Settings
This is a read/write property. With JScript, take care to double a backslash if one appears in the file path, as in the example below. An empty string indicates that the print-out should go to the printer driver.
Applies To
Example
factory.printing.printToFileName = "d://temp//printout.prn"
See Also
IsSpooling, Print, PrintHTML, PrintSetup, WaitForSpoolingComplete
rightMarginbasic
Description
Specifies the right margin for HTML print-outs. Cannot be set to be less than the printer's physically unprintable area (unprintableRight), in which case it will be automatically corrected to the minimum allowed value.If left and right margins overlap, they will be corrected to an arbitrary default value of 1/10 of page width.
ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
The rightMargin property is part of the basic freely-distributable printing subset.
Syntax
printing.rightMargin = numMargin
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
pageHeight, pageWidth, portrait, leftMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
GetMarginMeasure, PageSetup, Print, PrintHTML, SetMarginMeasure
serverName
Description
Returns a string giving the name of the server computer controlling the printer. If the string is empty then the printer is controlled locally.
Syntax
sName = printerControl.serverName
Settings
This is a read only property.
Applies To
shareName
Description
Returns a string identifying the share point of the printer. This value is only present if PRINTER_ATTRIBUTE_SHARED is set on attributes.
Syntax
sName = printerControl.shareName
Settings
This is a read only property.
Applies To
status
Description
Specifies the status of the printer, it can be any reasonable combination of the following values.
Value Meaning PRINTER_STATUS_BUSY (0x00000200) The printer is busy. PRINTER_STATUS_DOOR_OPEN (0x00400000) The printer door is open. PRINTER_STATUS_ERROR (0x00000002) The printer is in an error state. PRINTER_STATUS_INITIALIZING (0x00008000) The printer is initializing. PRINTER_STATUS_IO_ACTIVE (0x00000100) The printer is in an active input/output state PRINTER_STATUS_MANUAL_FEED (0x00000020) The printer is in a manual feed state. PRINTER_STATUS_NO_TONER (0x00040000) The printer is out of toner. PRINTER_STATUS_NOT_AVAILABLE (0x00001000) The printer is not available for printing. PRINTER_STATUS_OFFLINE (0x00000080) The printer is offline. PRINTER_STATUS_OUT_OF_MEMORY (0x00200000) The printer has run out of memory. PRINTER_STATUS_OUTPUT_BIN_FULL (0x00000800) The printer's output bin is full. PRINTER_STATUS_PAGE_PUNT (0x00080000) The printer cannot print the current page. Windows 95/98/Me: Indicates the page is being "punted" (that is, not printed) because it is too complex for the printer to print.
PRINTER_STATUS_PAPER_JAM (0x00000008) Paper is jammed in the printer PRINTER_STATUS_PAPER_OUT (0x00000010) The printer is out of paper. PRINTER_STATUS_PAPER_PROBLEM 0x00000040) The printer has a paper problem. PRINTER_STATUS_PAUSED (0x00000001) The printer is paused. PRINTER_STATUS_PENDING_DELETION (0x00000004) The printer is being deleted. PRINTER_STATUS_POWER_SAVE (0x01000000) The printer is in power save mode. PRINTER_STATUS_PRINTING (0x00000400) The printer is printing. PRINTER_STATUS_PROCESSING (0x00004000) The printer is processing a print job. PRINTER_STATUS_SERVER_UNKNOWN (0x00800000) The printer status is unknown. PRINTER_STATUS_TONER_LOW (0x00020000) The printer is low on toner. PRINTER_STATUS_USER_INTERVENTION (0x00100000) The printer has an error that requires the user to do something. PRINTER_STATUS_WAITING (0x00002000) The printer is waiting. PRINTER_STATUS_WARMING_UP (0x00010000) The printer is warming up.
Syntax
printerControl.status = nStatus
Settings
This is a read/write property. The user will require printer administrator writes in order to update the status.
Applies To
templateURLbasic (v6.3 and later)
Description
Specifies the URL of a custom Print Template?/span> for Internet Explorer 5.5 or later. Internet Explorer will use the specified template for all its printing operations.For ScriptX v6.3 and later, this property is also available as basic property, provided the value set is one of the following special values
Value Description MeadCo://IE55 The IE 5.5/IE 6 style template - note can be used on IE 7. MeadCo://IE7 The IE 7 style template - note free usage on all versions of IE 5.5 or later. MeadCo://Default The default template for the IE version in use, i.e. the template matches the browser version. This is the default behaviour. MeadCo://maxipt The MaxiPT template (requires a license). If you use your own templates with ScriptX, make sure that you insert a MeadCo's TriPrint Helper <OBJECT> into the <HEAD> section of the print template source:
<HTML XMLNS:IE> <HEAD> <?IMPORT namespace="ie" implementation="#default"> <!-- <TriPrint> (c) 2000, 2001 by Mead & Co Limited <triprint@meadroid.com> --> <object classid="clsid:1663ed6a-23eb-11d2-b92f-008048fdd814" viewastext> <param name="__PX__template" value="true"> </object> <!-- </TriPrint> --> <TITLE>Print Preview</TITLE>
Syntax
printing.templateURL = templateURL
Settings
This is a read/write property.
Applies To
Example
Read more about MeadCo's in-depth support for Print Templates?/span>.
See Also
topMarginbasic
Description
Specifies the top margin for HTML print-outs. Cannot be set to be less than the printer's physically unprintable area (unprintableTop), in which case it will be automatically corrected to the minimum allowed value. If top and bottom margins overlap, they will be corrected to default value of 1/10 of page width.
ScriptX uses the default units of measure of the user's system. In a broad network environment default units are certain to vary (they could be either inches or millimeters) so you may wish to specify a fixed unit of measure with the licensed function SetMarginMeasure.
The topMargin property is part of the basic freely-distributable printing subset.
Syntax
printing.topMargin = numMargin
Settings
This is a read/write property.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
leftMargin, pageHeight, pageWidth, portrait, rightMargin, bottomMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
GetMarginMeasure, PageSetup, Print, PrintHTML, SetMarginMeasure
unprintableBottom
Description
Returns the bottom unprintable page area (in current system measure units, inches or millimeters) for the current printer. It indicates the distance from the bottom edge of the page where no printing may occur.
Syntax
numMargin = printing.unprintableBottom
Settings
This is a read/only property.
Applies To
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, topMargin, unprintableLeft, unprintableRight, unprintableTop
unprintableLeft
Description
Returns the left unprintable page area (in current system measure units, inches or millimeters) for the current printer. It indicates the distance from the left edge of the page where no printing may occur.
Syntax
numMargin = printing.unprintableLeft
Settings
This is a read/only property.
Applies To
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, topMargin, unprintableBottom, unprintableRight, unprintableTop
unprintableRight
Description
Returns the right unprintable page area (in current system measure units, inches or millimeters) for the current printer. It indicates the distance from the right edge of the page where no printing may occur.
Syntax
numMargin = printing.unprintableRight
Settings
This is a read/only property.
Applies To
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, topMargin, unprintableBottom, unprintableLeft, unprintableTop
unprintableTop
Description
Returns the top unprintable page area (in current system measure units, inches or millimeters) for the current printer. It indicates the distance from the top edge of the page where no printing may occur.
Syntax
numMargin = printing.unprintableTop
Settings
This is a read/only property.
Applies To
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, topMargin, unprintableBottom, unprintableLeft, unprintableRight
Methods and Functions
BatchPrintPDF
Description
Downloads Adobe Acrobattm or Microsoft Officetm files and prints them out in batch mode in the background. Any number of print-outs can be queued. As of the present release of ScriptX, BatchPrintPDF prints only on the default printer using default settings.
To print PDF files, the Adobe Acrobat Readertm 4.0 or later should be present on the client system. It can be freely downloaded from the Adobe website?/span>.
Please note: This method uses DDE to converse with Adobe Acrobat Readertm and is known to work well with Adobe Acrobat Readertm versions 4 and 5 - problems may be encountered with Adobe Acrobat Readertm 6 (due to security restrictions introduced in Adobe Acrobat Readertm v6 it is possible for the user to [accidentally] disable printing altogether) and problems will almost certainly be encountered with Adobe Acrobat Readertm 7 and later to the extent that printing does not work at all or is intermittent. In other words, for v6 and later "your mileage may vary". We strongly recommend that if you intend to use this functionality of ScriptX you obtain an evaluation license and test your usage scenarios very carefully.
Use IsSpooling to check if there are any outstanding downloads in the queue created by BatchPrintPDF. Use WaitForSpoolingComplete to wait for all documents to be downloaded and spooled.
Syntax
printing.BatchPrintPDF(url)
Example
Here is a basic example of BatchPrintPDF use
<body> <!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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() { idPrint.disabled = false; } function BatchPrintPDF(url) { factory.printing.BatchPrintPDF(url); } </script> <input id=idPrint disabled type="button" value="PrintHTML('info.htm')" onclick="BatchPrintPDF('report.pdf')"> </body>
Applies To
See Also
DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, IsSpooling, PrintHTML, PrintPDF, Sleep, WaitForSpoolingComplete
DefaultPrinter
Description
Returns the name of the default printer (if any).
Syntax
printerName = printing.DefaultPrinter()
Applies To
See Also
EnumJobs, EnumPrinters, GetJobsCount, IsTemplateSupported, Print
DoPrint
Description
The alias for the Print method (retained for compatibility reasons).
Applies To
See Also
EnumJobs
Description
Enumerates active jobs on the given printer.
Syntax
var jobName = {}
status = printing.EnumJobs(printerName, index, jobName)
Parameter Description printerName (String) printer name on which to enumerate the jobs index (Number) Zero-based index of the job. Increment this value for each new EnumJobs call for a given printerName
An index of -1 will return the status of the printer, rather than a particular job.jobName (Object) obtains a name for the job (available as jobName[0])
Return Value
Returns a numeric value indicating the current status of the job. The bits have the following meaning:
Meaning Value JOB_STATUS_PAUSED 0x00000001 JOB_STATUS_ERROR 0x00000002 JOB_STATUS_DELETING 0x00000004 JOB_STATUS_SPOOLING 0x00000008 JOB_STATUS_PRINTING 0x00000010 JOB_STATUS_OFFLINE 0x00000020 JOB_STATUS_PAPEROUT 0x00000040 JOB_STATUS_PRINTED 0x00000080 JOB_STATUS_DELETED 0x00000100 JOB_STATUS_BLOCKED_DEVQ 0x00000200 JOB_STATUS_USER_INTERVENTION 0x00000400 JOB_STATUS_RESTART 0x00000800
Example
<script defer> function window.onload() { for ( i = 0; printer = factory.printing.EnumPrinters(i); i++ ) { alert("Printer name: "+printer); var job = {}; for ( j = 0; status = factory.printing.EnumJobs(printer, j, job); j++ ) alert("Job name: "+job[0]+", status: "+status); } } </script>
Applies To
See Also
EnumPrinters
Description
Enumerates locally-available printers.
Syntax
printerName = printing.EnumPrinters(index)
Parameter Description index (Number) Zero-based index of the printer. Increment this value for each new EnumPrinters call
Return Value
Returns the string name of the next printer. An empty value means that enumeration is over.
Example
<!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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> <p><small id=idOutput></small> <script defer> function OutputHtml(html) { idOutput.insertAdjacentHTML("BeforeEnd", html) idOutput.scrollIntoView(false) } function EnumAll() { OutputHtml("Default printer: <b>" + factory.printing.DefaultPrinter() + "</b><br>") for ( i = 0; name = factory.printing.EnumPrinters(i); i++ ) { OutputHtml("Printer: <b>" + name + "</b><br>Job count: " + factory.printing.GetJobsCount(name) + "<br>") var jobName = {} for ( j = 0; status = factory.printing.EnumJobs(name, j, jobName); j++ ) OutputHtml("Job: <b>" + jobName[0]+"</b>Status: " + new Number(status).toString(16) + "<br>") } } function window.onload() { EnumAll() } </script>
Applies To
See Also
DefaultPrinter, EnumJobs, EnumPrinters, GetJobsCount, Print, PrintSetup
GetJobsCount
Description
Returns the number of printing jobs for the specified printer.
Syntax
numJobs = printing.GetJobsCount(printer)
Return Value
Returns a numeric value.
Applies To
See Also
GetMarginMeasure
Description
Returns current units of measure for print-out margins, either millimeters or inches. Use SetMarginMeasure to switch the default units.
Syntax
units = printing.GetMarginMeasure()
Return Value
Returns the currently-set units of measure. 1 stands for millimeters, 2 for inches.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, rightMargin, templateURL, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
IsSpooling
Description
Checks if spooling is in progress as result of a Print call, or for any downloads outstanding in the queue created by PrintHTML, PrintXML or BatchPrintPDF calls.
You can force the blocking wait state with WaitForSpoolingComplete to make sure all downloads are complete and spooling is done at any point in your code.
Syntax
isSpooling = printing.IsSpooling()
Return Value
Returns a boolean value indicating whether or not there are still outstanding unspooled downloads to be printed
Example
The following example closes the window when the spooling is done:
<script defer> function PrintAllDocs() { factory.printing.PrintHTML("info.htm"); factory.printing.PrintXML(src1); factory.printing.PrintXML(src2); CheckSpooling(); } function CheckSpooling() { if ( !factory.printing.IsSpooling() ) window.close() setTimeout("CheckSpooling()", 1000); } </script>
See Also
BatchPrintPDF, OwnQueue, Print, PrintHTML, PrintXML, Sleep, WaitForSpoolingComplete
IsTemplateSupportedbasic
Description
Checks whether or not Print Templates?/span> are supported on the end user's system (i.e. checks for Internet Explorer 5.5 or later).
Syntax
isTemplateSupported = printing.IsTemplateSupported()
Return Value
Returns a boolean value indicating whether or not Print Templates are supported.
Applies To
See Also
OwnQueue
Description
OwnQueue is used to organize a detached printing queue. Use this method to queue all PrintHTML calls in a separate process. The process is disconnected from the current session (cookies, SSL context, etc) but the calling window can be closed at any time without waiting for spooling to compete.
OwnQueue should be called before any PrintHTML or PrintXML commands to take effect.
Syntax
printing.OwnQueue()
Applies To
See Also
PageSetupbasic
Description
Invokes the standard Internet Explorer Page Setup... dialog. If the user closes the dialog with the OK button, current settings will be updated and an onpagesetup event will be fired.
The PageSetup method is part of the basic freely-distributable printing subset.
Syntax
result = printing.PageSetup()
Return Value
Returns a boolean value indicating whether or not a user has closed the dialog with the OK button.
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
Applies To
See Also
bottomMargin, disableUI, footer, header, leftMargin, onpagesetup, onuserpagesetup, paperSize, paperSource, portrait, rightMargin, topMargin
Pause
Description
Pauses either the entire print queue or an individual job. In order to pause a print queue the user must possess administration rights on the printer, jobs belonging to the user may be paused.
Syntax
o.Pause()
Applies To
See Also
Previewbasic
Description
Invokes the Print Preview... pane in Internet Explorer 5.5 and later.
The Preview method is part of the basic freely-distributable printing subset.
Syntax
printing.Preview(oFrame)
Parameter Description oFrame [Optional] HTML frame to preview. By default, the top-level containing page will be previewed (i.e. the whole browser window content). The use of this parameter is not part of the basic subset, a license is required. Without a license, default behaviour (preview the whole window) will occur.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
Printbasic
Description
Prints the contents of the specified window or frame using the current printing settings. Please note these important changes regarding printing without a prompt.
This method is part of the basic freely-distributable printing subset.
However, the acquisition of a MeadCo Publishing License?/span> 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 frameOrWindow (Object) optional HTML frame or window?/span> to print. By default, the containing page (that hosts the ScriptX object) will be printed
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=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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
See Also
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
PrintHTML
Description
Prints either specified HTML text or the HTML or XML document specified by the URL using the current printing settings in the same session context. The method is asynchronous. It returns before the document is downloaded and printed.
PrintHTML may be used to organize a printing queue in a separate process, in which case the current window may be closed without waiting for pending downloads to complete. See OwnQueue for more details.
Syntax
printing.PrintHTML(url[, prompt = false])
Parameter Description url (String) URL/html text to print:
Protocol Prints html:// The html is loaded and printed, e.g. html://<html><head><title>Dynamic Printing</title></head><body>Hello world!</body></html> any other, e.g. http://, https:// or if no protocol specified. The document is downloaded and printed. A relative (to the current page) url may be given. prompt (Bool) Specifies whether or not the user should be prompted before the download is queued
Return Value
Returns false if printing with a prompt and the user cancels the printing.
Applies To
Examples
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
The following simple but complete example shows how to print an externally-located document:
<body> <!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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() { idPrint.disabled = false; } function PrintHTML(url) { factory.printing.PrintHTML(url); } </script> <input id=idPrint disabled type="button" value="PrintHTML('info.htm')" onclick="PrintHTML('info.htm')"> </body>The following example illustrates dynamic creation of the HTML to be printed:
<!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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> function doPrintDemo() { var n; var str = "<html><head>"; str += "<link rel='stylesheet' type='text/css' href='/zeepe/resources/zp_content.css' />"; str += "<title>ScriptX Dynamic Reports</title></head><body>"; for (n=0; n<10; n++) { str += "<p>Dynamically created line number: " + (n+1) + "</p>"; } str += "<hr/><p>Note that style sheets, scripts, images etc must be referenced by their full url</p>"); str += "</body></html>"; factory.printing.header = "ScriptX Dynamic Printing"; factory.printing.footer = ""; factory.printing.printHTML("html://"+str); } </script>
See Also
bottomMargin, collate, copies, duplex, footer, header, leftMargin, onafterprint, onuserprint, paperSize, paperSource, portrait, printBackground, printer, printToFileName, rightMargin, templateURL, topMargin
BatchPrintPDF, IsSpooling, OwnQueue, PageSetup, Print, PrintSetup, PrintXML, WaitForSpoolingComplete
PrintPDF
Description
Prints a document's inline PDF content. The HTML page should host an instance of the Adobe Acrobat Readertm ActiveX control that loads the PDF file. The control is a part Adobe Acrobat Readertm 4.0 or later which can be freely downloaded from the Adobe website?
As of the present release of ScriptX, PrintPDF prints only on the default printer using default settings.
Please note: This method is known to work well with Adobe Acrobat Readertm versions 4 and 5 - problems may be encountered with Adobe Acrobat Readertm 6 and problems will almost certainly be encountered with Adobe Acrobat Readertm 7 and later. In other words, for v6 and later "your mileage may vary".
Syntax
printing.PrintPDF(idPDF[, prompt = true[, shrinkToFit = true [, from = -1[, to = -1]]]);
Parameter Description idPDF (Object) id of the Adobe Acrobat Reader control hosted on the same document or frame
as shown in the example belowprompt (Bool) Indicates whether or not to prompt the user before printing shrinkToFit (Bool) Shrink the PDF page to fit the paper, optional, true by default from (Number) Print from the specified page, optional, all pages by default to (Number) Print to the specified page, optional, all pages by default
Return Value
Returns a boolean value indicating whether or not there are still outstanding downloads to be printed.
Example
<body> <!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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> <!-- Adobe Acrobat Readertm ActiveX Control --> <object id=idPDF width=50% height=50% classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"> <param name="src" value="ReadMe.pdf"> </object> <script defer> function window.onload() { idPrint.disabled = false; } function PrintPDF(url) { factory.printing.PrintPDF(idPDF); } </script> <input id=idPrint disabled type="button" value="Print the PDF" onclick="PrintPDF()"> </body>
Applies To
See Also
PrintSetup
Description
Invokes the standard Windows Print Setup... dialog, thus allowing a user to modify current print settings. If the user closes the dialog with the OK button, current settings will be updated and an onpagesetup event will be fired. No printing will occur in either case.
Syntax
result = printing.PrintSetup()
Return Value
Returns a boolean value indicating whether or not the user has closed the dialog with the OK button.
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
Applies To
See Also
collate, copies, disableUI, duplex, printer, printToFileName
PrintXML
Description
This method is an alias for PrintHTML, preserved for compatibility reasons. You can print both XML (XSL-processed) and HTML files with PrintHTML. See the PrintHTML method description for more info.
Example
The following simple but complete example shows how to print an externally-located XML document:
<head> <title>MeadCo's ScriptX: PrintXML</title> <!-- special style sheet for printing --> <style media="print"> .noprint { display: none } </style> </head> <body> <!-- MeadCo Security Manager - using evaluation license --> <object viewastext style="display:none" classid="clsid:5445be81-b796-11d2-b931-002018654e2e" codebase="smsx.cab#Version=6,3,435,20"> <param name="GUID" value="{232E61C9-1E90-4657-AEDB-6F02F3B2EE37}"> <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() { idPrint.disabled = false; } function Print() { // set footer factory.printing.footer = "Printed with MeadCo's ScriptX"; // print this page factory.printing.Print(false); // print linked pages var links = idLinks.all.tags("A"); for ( i = 0; i < links.length; i++ ) factory.printing.PrintXML(links[i].href) } </script> <p><input id=idPrint class=noprint disabled type="button" value="Print the page and links" onclick="Print()"> <p>XML links: <span id=idLinks> <a href="info1.xml">Info 1</a> <a href="info2.xml">Info 2</a> <a href="info3.xml">Info 3</a> </span> </body>
See Also
bottomMargin, collate, copies, duplex, footer, header, leftMargin, onafterprint, onuserprint, paperSize, paperSource, portrait, printBackground, printer, printToFileName, rightMargin, templateURL, topMargin
BatchPrintPDF, IsSpooling, OwnQueue, PageSetup, Print, PrintHTML, PrintSetup, WaitForSpoolingComplete
Purge
Description
Purges all pending print jobs in the queue for the printer. The user must posses administration rights on the printer.
Syntax
o.Purge()
Applies To
See Also
Restart
Description
Restarts the print job - the job must belong to the user or the user must possess administration rights on the printer.
Syntax
job.Restart()
Applies To
See Also
Resume
Description
Resumes either the entire print queue or an individual job. In order to resume a paused print queue the user must possess administration rights on the printer, paused jobs belonging to the user may be resumed.
Syntax
o.Resume()
Applies To
See Also
SetMarginMeasure
Description
Sets the units of measure for print-out margins.
Syntax
printing.SetMarginMeasure(units)
Parameter Description units (Number) 1 stands for millimeters, 2 for inches.
Applies To
Example
Check out the source code of the ScriptX Advanced Printing and ScriptX Techie Printing examples.
See Also
bottomMargin, leftMargin, pageHeight, pageWidth, paperSize, rightMargin, topMargin, unprintableBottom, unprintableLeft, unprintableRight, unprintableTop
SetPageRange
Description
Sets the page selection to print.
It is not possible to know in advance the exact number of pages which will be printed unless you're using a custom Print Template?/span> (Internet Explorer 5.5 or later). MeadCo's MaxiPT 1.0?/span> custom Print Template allows you to specify arbitrary page ranges, as well as only odd, even or both odd and even pages with different margin and header/footer settings.
Syntax
printing.SetPageRange(selectionOnly[, from, to])
Parameter Description selectionOnly (Bool) print the highlighted HTML selection only from (Number) print from the page, 1-based. Use 0 to print all pages to (Number) print to the page, 1-based
Applies To
See Also
SetPrintScale (v6.3.435 and later)
Description
Use this method to specify the scale to be used during printing - this is print scaling, not view zooming.
The IE 7 style template is required for this method to have any effect.
Syntax
printing.SetPrintScale(lScale,)
Parameter Description lScale (Number) The print scale to use, expressed as a percentage. The value must be either -1 or between 30 and 999 or it will be ignored.
The special value -1 denotes 'scale to fit' where, if necessary, the content is scaled to fit the width of the paper - if scaling is not necessary to fit, 100% scaling is used.
Applies To
Example
function startPreview() { var s = document.getElementById("selectScale"); factory.printing.SetPrintScale(s.options[s.selectedIndex].value); }
See Also
SetPreviewZoom (v6.3.435 and later)
Description
Use this method to specify the Zoom to be used during print preview - this is view zooming, not print scaling.
Syntax
printing.SetPrintZoom(lZoom,,pagesX,pagesY)
Parameter Description lZoom (Number) The Zoom scaling to use, either expressed as a percentage (e.g. 200 for double full size) or one of the following special values: For the IE 6 and earlier style template, the default value is 75%. For IE 7 and later style template, the default value is -2.
-1 Zoom to show the full page width in the view. -2 Zoom to show the full page height in the view. -3 Zoom to show 2 full height pages in the view. 0 Zoom to show full height pages, layed out as described by the pagesX and pagesY parameters (requires the IE 7 style template). pagesX (optional, requires the IE 7 style template) (Number) Only used with the IE 7 style template when lZoom is 0. Specifies the number of pages to display across the view (columns). pagesY (optional, requires the IE 7 style template) (Number) Only used with the IE 7 style template when lZoom is 0. Specifies the number of rows of pages to display.
Applies To
Example
function startPreview() { var z,x=0,y=0; if ( document.getElementById("selectTemplate").selectedIndex != 1 ) { // if not IE 7 template var s = document.getElementById("selectZoom"); z = s.options[s.selectedIndex].value; } else { var s = document.getElementById("selectZoom"); var s1 = document.getElementById("selectPages"); var o = parseInt(s1.options[s1.selectedIndex].value); switch (o) { case 0: // zoomed one page z = s.options[s.selectedIndex].value; break; case 2: // the rest are multi-page views. z = 0; x = 2; y = 1; break; case 3: z = 0; x = 3; y = 1; break; case 6: z = 0; x = 3; y = 2; break; case 12: z = 0; x = 4; y = 3; break; } } factory.printing.SetPreviewZoom(z,x,y); factory.printing.Preview(); }
See Also
Sleep
Description
Suspends (sleeps) script execution for a specified timeout or until a passed callback function returns true. This is an efficient way to wait for an event without burning CPU cycles.
Syntax
Parameter Description timeout (Number) the timeout in milliseconds. callback (Function)the optional pointer to the function to be periodically called within the Sleep method.
When the function returns true, the sleep is canceled.
Return Value
Returns true if the sleep was canceled by a callback function.
Applies To
Example
The following code snippet navigates a frame to a file then prints its content:
<script defer> function NavigatePrintFrame(url) { idFrame.navigate(url); factory.printing.Sleep(100) // let the navigation start factory.printing.Sleep(1000*60, IsReady) // sleep for 1 minute or until the document is ready factory.printing.Print(true, idFrame) } function IsReady() { return idFrame.document.readyState == "complete" } </script>
See Also
WaitForSpoolingComplete
Description
Waits for all pending download and spooling operations originated with Print, PrintHTML/PrintXML and BatchPrintPDF calls to complete. WaitForSpoolingComplete provides visual feedback such as a modal window state and an hourglass cursor.
Syntax
printing.WaitForSpoolingComplete()
Return Value
Returns a boolean value indicating whether or not there are still outstanding unspooled downloads to be printed.
Example
Check out the source code of the ScriptX Techie Printing example.
<script defer> function PrintAndGo() { if ( factory.printing.Print() ) factory.printing.WaitForSpoolingComplete() window.close() } </script>
Applies To
See Also
BatchPrintPDF, IsSpooling, OwnQueue, Print, PrintHTML, Sleep
MeadCo's ScriptX, MaxiPT and the MeadCo Security Manager are Copyright (c) Mead & Co Limited, 1998-2003.
Microsoft, Windows, Internet Explorer are registered trademarks of Microsoft Corporation. All companies and product names mentioned are trademarks of the respective companies.
MeadCo ScriptX Control
发表评论
-
打包并自动安装SQL数据库
2007-08-05 13:04 585NET平台下WEB应用程序的 ... -
如何管理 Internet Explorer 6 中的 Cookie
2007-10-17 16:33 934本页 概要 更多信息 针对站点的 ... -
JSTL简介
2007-11-30 10:54 518JSTL是一个不断完善的开 ... -
实战web 2.0
2007-12-03 09:02 5092001年,是一个注定将被 ... -
css之自动换行
2007-12-29 15:44 1273作者:Scott Mitchell 概述在此之前我已 ... -
eXtremeComponents介绍
2008-01-18 12:39 719eXtremeComponents介绍luckyhttp:// ... -
eXtremeComponents指南
2008-01-18 12:40 567extremeComponents指南 ... -
eXtremeComponents指南
2008-01-18 12:40 798extremeComponents指南 ... -
js常用资料
2008-01-24 09:46 942事件源对象 event.srcElement.t ... -
比较全的CSS cursor(鼠标样式)
2008-04-08 11:56 511十字准心 cursor:crosshair;手 cu ...
相关推荐
`MeadCo's ScriptX Printing Programming Manual.mht` 文件 这个文件很可能是MeadCo公司提供的ScriptX编程手册,以MHT(单个文件网页)格式保存。MHT是一种将HTML、图像和其他资源合并到一个文件中的格式,方便...
Web打印控件ScriptX是一种专为网页打印设计的技术解决方案,尤其在JavaScript环境下有着广泛的应用。它允许用户通过浏览器直接打印网页内容,而无需借助其他插件或者弹出打印对话框,提高了网页打印的便捷性和用户...
scriptx 博文链接:https://clarancepeng.iteye.com/blog/110637
标题中的"SCRIPTX免费的active控件"指的是ScriptX,这是一个ActiveX控件,专为在Internet Explorer中实现高质量的打印功能而设计。ActiveX控件是一种基于微软技术的组件,可以在网页中嵌入,提供额外的功能和服务。 ...
脚本X 通用的脚本引擎抽象层 ScriptX是脚本引擎抽象层。 底部封装了各种脚本引擎,顶部封装了统一的API,因此上层调用者可以完全隔离底层引擎实现(后端)。 ScriptX不仅隔离了几个JavaScript引擎,但甚至可以分离...
这个“ScriptX使用完整事例”是作者针对ScriptX进行深入研究后整理出来的一个实例,旨在帮助对ScriptX感兴趣的开发者更好地理解和应用这款工具。 首先,ScriptX的核心功能是提供对打印设置的精细控制,包括页面布局...
ScriptX 允许您直接从地址栏编写控制台脚本。 随时保存和运行任何脚本。 所以让我们启动 SrciptX。 请找到我们关于如何使用 javascript 抓取/调整/添加功能的教程。 脚本模板 ScriptX 附带 10 个最有用的脚本,这些...
ScriptX控件是一款由Meadroid公司开发的专业Web打印解决方案,它允许网页开发者在没有打印机驱动的情况下实现高质量的打印功能。这款控件尤其适用于那些希望提供一致、无干扰打印体验的Web应用程序。本文将深入探讨...
"meadco scriptx activex控件安装包.zip" 是一个包含Meadco ScriptX Activex控件的安装程序的压缩文件。这个标题表明它是一个专为安装ScriptX控件设计的软件包,使用的是ActiveX技术,这是一种在Windows平台上常见的...
**ScriptX打印插件**是一种专业且跨平台的打印解决方案,尤其适合那些需要高效、定制化打印功能的应用程序。此插件由Meadow Systems开发,旨在为用户提供简单易用的打印体验,无论是在Windows、Web还是移动平台上,...
**ScriptX打印控件**是Meadroid公司推出的一款专门用于增强Web页面打印功能的控件,它为开发者提供了一种高效、灵活的解决方案,帮助实现高质量、自定义的网页打印效果。在传统的Web浏览器中,打印功能往往简单且...
标题"meadco scriptx的activex控件手动安装包.zip"指出,这个压缩包包含了Meadco ScriptX的ActiveX控件的手动安装程序。ScriptX是一款由Meadco公司开发的打印解决方案,它允许网页开发者在浏览器环境中控制打印功能...
**Meadco ScriptX ActiveX 控件:技术详解与手动安装指南** Meadco ScriptX 是一款由 Meadco 公司开发的ActiveX控件,主要用于网页打印和页面控制。它提供了高级的打印功能,使得开发者能够在浏览器环境中实现...
scriptx打印控件就不用我做介绍了吧 演示地址:需先根据提示安装根证书 http://g.99081.com/netnec/ http://users5.titanichost.com/netnec/scriptx/
**WEB打印控件ScriptX详解** 在Web应用中,实现用户友好的打印功能是一项重要的需求。ScriptX是一款专业且强大的WEB打印控件,它由Meadroid公司开发,旨在为网页提供高效、精确的打印解决方案。这款控件的出现,...
ScriptX是一款由Meadroid公司开发的打印解决方案,主要用于在Web浏览器中实现高质量的文档打印。这个"ScriptX打印例子DEMO 包含cab文件"是ScriptX技术的一个演示,帮助开发者了解如何集成和利用ScriptX进行网页打印...
ScriptX web打印控件 控件使用 <object id=\"factory\" viewastext style=\"display:none\" classid=\"clsid:1663ed61-23eb-11d2-b92f-008048fdd814\" codebase=\"http://[your-path]/smsx.cab#Version=6,3,...
ScriptX控件是一款由Meadroid公司开发的用于打印和PDF创建的专业工具,它主要应用于Microsoft Internet Explorer浏览器。在Windows环境中,ScriptX控件能够帮助开发者实现网页内容的高质量打印功能,无需用户安装...