Namespace

factory

factory

MeadCo ScriptX 'window.factory' shim (support for modern browsers and IE 11) JS client library.

The ScriptX Add-on for Internet Explorer is included on a html document with an <object /> element with a de-facto standard id of 'factory': <object id='factory' />.

The object is referenced with the property window.factory which exposes properties and methods to define print setting and perform operations such as printing a document or frame.

The object has three further properties:

  • object
    • js
  • rawPrinting
  • printing
    • printerControl
    • enhancedFormatting

This javascript 'module' provides partial emulation of window.factory, window.factory.object and window.factory.object.js

Full emulation (and almost complete implementation) is provided for window.factory.printing, window.factory.printing.printerControl, window.factory.printing.enhancedFormatting. The most notable absent implementation is an implementation of print preview.

Full emulation is provided for window.factory.rawPrinting. Please note that the implementation is synchronous and browsers will issue a warning to the console.

ScriptX Add-on for Internet Explorer intercepts the browser UI for printing. For obvious reasons this is not possible with javascript, however ::

PLEASE NOTE: This library replaces window.print().

Full documentation on the properties/methods is provided by the technical reference documentation for the ScriptX Add-on for Internet Explorer. That documentation is not reproduced here.

If the startup script determines that the ScriptX Add.on for IE is already active then it will quietly give priority to the object. In other words, the Add-on has precedence on Internet Explorer.

This enables the same experience (almost) to be delivered to any browser on any device with the same html/javascript code.

It is strongly recommended that the MeadCoScriptJS library is used in conjunction with this library as it provides code (Promises) to assist with working with the significant difference between the synchronous nature of the functions of ScriptX.Add-on (which hide the underlying asynchrony) and the asynchronous nature of javascript AJAX processing.

Requires:

  • MeadCo.Core

  • MeadCo.ScriptX.Print

  • MeadCo.ScriptX.Print.HTML

  • MeadCo.ScriptX.Print.Licensing when using ScritpX.Services for Windows PC

MeadCo.ScriptX.Print.HTML.connectAsync or MeadCo.ScriptX.Print.connectAsync MUST be called before using the apis in this library.

See ScriptX Samples for a lot of samples on using this code.

Some Add-on APIs lead to system provided dialogs (e.g. printer and paper setup) - support for implementing the dialogs in javascript as simple plug-ins is provided, along with an example implementation using bootstrap/jQuery (see jQuery-MeadCo.ScriptX.Print.UI.js)

View Source meadco-scriptxfactory.js, line 1

Example

MeadCo.ScriptX.Print.UI = {
   PageSetup: function(fnDialgCompleteCallBack) { ... dialog code ...},
   PrinterSettings: function(fnDialgCompleteCallBack) { ... dialog code ...}
}