MeadCo : object

Static class for namespace creation and core utility functions for ScriptX.Services client libraries.

This must be included before any other files from this package.

The implementation is for use in a browser only, not general runtime javascript environments.

This code is necessarily 'old-fashioned' as it may find itself running in old versions of IE.


MeadCo.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


MeadCo.logEnabled

Get/set state of logging to console of informational messages. Default is off

Properties

Name Type
logEnabled boolean


MeadCo.log(text)

Sends the content to the console (if informational logging is enabled)

Param Type Description
text string to send to console


MeadCo.warn(text)

Marks the content as a warning and sends to the console

Param Type Description
text string to send to console


MeadCo.error(text)

Marks the content as an error and sends to the console

Param Type Description
text string to send to console


MeadCo.createNS(namespace) ⇒ object

Create a namespace

Param Type Description
namespace string path of the namespace

Returns: object - static object for the namespace
Example

var ui = MeadCo.createNS("MeadCo.ScriptX.Print.UI");
ui.Show = function() { alert("hello"); }


MeadCo.makeApiEndPoint(serverUrl, apiLocation) ⇒ string

Get the url to a ScriptX.Services api endpoint. If an enpoint is already present, it is replaced.

Param Type Description
serverUrl string url to the server
apiLocation string the api, e.g. v1/printhtml

Returns: string - url to the api

MeadCo.parseAjaxError(logText, jqXhr, textStatus, errorThrown) ⇒ string

Extract the error text from jQuery AJAX response

Param Type Description
logText string The lead-in text for a console.log entry
jqXhr object jQuery ajax header
textStatus string textStatus result determined by jQuery
errorThrown string The server exception dewtermined by jQuery

Returns: string - The error text to display

factory : object

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)

Example

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


MeadCo.ScriptX.Print : object

MeadCo.ScriptX.Print

A static class wrapping calls to the server API.

Requires: meadco-core.js

Includes processing of calls to the print api that return "printing to file" including collecting the file output.

Provides attribute based connection to the server.

Synchronous AJAX calls are deprecated in all browsers but may be useful to "quick start" use of older code. It is recommended that code is moved to using asynchronous calls as soon as practical. The MeadCoScriptXJS library can assist with this as it delivers promise rather than callback based code.


MeadCo.ScriptX.Print.onErrorAction

Get/set the action to take when an error occurs

Properties

Name Type Description
onErrorAction ErrorAction the action


MeadCo.ScriptX.Print.printerName

Get/set the currently active printer

Properties

Name Type Description
printerName string The name of the current printer in use.


MeadCo.ScriptX.Print.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


MeadCo.ScriptX.Print.deviceSettings

Get/set the cached device settings (papersize etc) for the currently active printer

Properties

Name Type Description
deviceSettings DeviceSettingsObject (see API /api/vi/printhtml/deviceInfo/ )


MeadCo.ScriptX.Print.isConnected

true if the library has succesfully connected to a server.

Read only: true
Properties

Name Type Description
isConnected bool true if the library has succesfully connected to a server.


MeadCo.ScriptX.Print.availablePrinterNames

Get the list of printers availablefrom the server.

Read only: true
Properties

Name Type Description
availablePrinterNames Array.<string> an array of strings of the names of the available printers


MeadCo.ScriptX.Print.queue

The list of jobs currently active at the server for this client

Read only: true
Properties

Name Type Description
queue Array.<object> array of jobs


MeadCo.ScriptX.Print.activeJobs

The number of jobs there are actgive at the server for this client (same as MeadCo.ScriptX.Print.queue.length)

Read only: true
Properties

Name Type Description
activeJobs int the number of jobs


MeadCo.ScriptX.Print.isSpooling

Get if print is still 'spooling'.still queued at the server

Read only: true
Properties

Name Type
isSpooling bool


MeadCo.ScriptX.Print.MeasurementUnits : enum

Enum to describe the units used on measurements. Please be aware that (sadly) these enum values do not match
the values by the MeadCo ScriptX COM Servers. Please use MeadCo.ScriptX.MeasurementUnits (declared in MeadCoScriptJS) form compatibility

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
INCHES number 1
MM number 2 millimeters


MeadCo.ScriptX.Print.ContentType : enum

Enum for type of content being posted to printHtml API

Read only: true
Properties

Name Type Description
URL number 1 the url will be downloaded and printed
HTML number 2 the passed string is assumed to be a complete html document .. ..
INNERHTML number 4 the passed string is a complete html document but missing the html tags
STRING number 8 the passed string is assumed to contain no html but may contain other language such as ZPL (for direct printing)


MeadCo.ScriptX.Print.ErrorAction : enum

Enum for type of content being posted to printHtml API

Read only: true
Properties

Name Type Description
REPORT number 1 Call MeadCo.ScriptX.Print.reportServerError(errMsg)
THROW number 2 throw an error : throw errMsg


MeadCo.ScriptX.Print.ServiceClasses : enum

Enum for the class of service connected to.

Read only: true
Properties

Name Type Description
CLOUD number 1 MeadCo Cloud Service
ONPREMISE number 2 ScriptX.Services for On Premise Devices
WINDOWSPC number 3 ScriptX.Services for Windows PC


MeadCo.ScriptX.Print.PrintStatus : enum

Enum for status code returned to print progress callbacks

Read only: true
Properties

Name Type Description
NOTSTARTED number 0
QUEUED number 1
STARTING number 2
DOWNLOADING number 3
DOWNLOADED number 4
PRINTING number 5
COMPLETED number 6
PAUSED number 7
PRINTPDF number 8
ERROR number 1
ABANDONED number 2


MeadCo.ScriptX.Print.CollateOptions : enum

Enum to describe the collation option when printing

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
TRUE number 1 collate pages when printing
FALSE number 2 do not collate pages


MeadCo.ScriptX.Print.DuplexOptions : enum

Enum to describe the duplex print option to use when printing

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
SIMPLEX number 1
VERTICAL number 2
HORIZONTAL number 3


MeadCo.ScriptX.Print.serviceVersion() ⇒ VersionObject

Get the version of the service connected to.

Returns: VersionObject - the version

MeadCo.ScriptX.Print.serviceVersionAsync(resolve, reject)

Get the version of the service connected to.

Param Type Description
resolve function function to call on success
reject function function to call on failure


MeadCo.ScriptX.Print.deviceSettingsFor(sPrinterName) ⇒ DeviceSettingsObject

Get the device settings (papersize etc) for the named printer. This call is synchronous and not recommended.

Param Type Description
sPrinterName string the name of the printer device to return the settings for

Returns: DeviceSettingsObject - object with properties

MeadCo.ScriptX.Print.useAttributes()

search for processing attibutes for connection and subscription/license and process them. The attibutes can be on any element

data-meadco-server value is the root url, api/v1/printhtml, api/v1/licensing will be added by the library data-meadco-syncinit default is true for synchronous calls to the server, value 'false' to use asynchronous calls to the server

data-meadco-subscription present => cloud/on premise service, value is the subscription GUID data-meadco-license present => for Windows PC service, value is the license GUID

If data-meadco-license is present then the following additional attributes can be used:

data-meadco-license-revision, value is the revision number of the license data-meadco-license-path,, value is the path to the license file (sxlic.mlf). A value of "warehouse" will cause the license to be downloaded from MeadCo's License Warehouse

Synchronous AJAX calls are deprecated in all browsers but may be useful to "quick start" use of older code. It is recommended that code is moved to using asynchronous calls as soon as practical. The MeadCoScriptXJS library can assist with this as it delivers promise rather than callback based code.

Example

<!-- an example connection to an On Premise server for ScriptX.Services -->
<script src="lib/meadco-scriptxservicesprintUI.min.js" 
     data-meadco-server="https://app.corpservices/" 
     data-meadco-subscription="" data-meadco-syncinit="false">
</script>;

<!-- an example connection to ScriptX.Services for Windows PC -->
<script src="lib/meadco-scriptxservicesUI.min.js"
     data-meadco-server="http://127.0.0.1:41191" 
     data-meadco-license="{6BC6808B-D645-40B6-AE80-E9D0825797EF}" 
     data-meadco-syncinit="false" 
     data-meadco-license-path="warehouse"
     data-meadco-license-revision="3">
</script>


MeadCo.ScriptX.Print.connect(serverUrl, licenseGuid)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain the device settings for the default printer. This call is synchronous and therefore not recommended. Use connectAsync()

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier


MeadCo.ScriptX.Print.connectLite(serverUrl, licenseGuid)

Specify the server and the subscription/license id to use on AJAX calls. No call is made in this function

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier


MeadCo.ScriptX.Print.connectAsync(serverUrl, licenseGuid, resolve, reject)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain the device settings for the default printer.

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier
resolve function function to call on success, dataObject contains the device settings for the default device.
reject function function to call on failure


MeadCo.ScriptX.Print.connectTestAsync(serverUrl, resolve, reject)

Test if there is a MeadCo PrintHtml API server at the url

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
resolve function function to call on success
reject function function to call on failure


MeadCo.ScriptX.Print.serviceDescription() ⇒ ServiceDescriptionObject

Obtain the description of the service provided by the server

Returns: ServiceDescriptionObject - serviceDescription

MeadCo.ScriptX.Print.serviceDescriptionAsync(resolve, reject)

Obtain the description of the service provided by the server

Param Type Description
resolve function function to call on success
reject function function to call on failure


MeadCo.ScriptX.Print.connectDeviceAndPrinters(deviceInfo, arPrinters)

Cache the given device info and available printers in this static class instance

Used by libraries that call api/v1/printHtml/htmlPrintDefaults

Param Type Description
deviceInfo object the device name and settings (papersize etc)
arPrinters array the names of the available printers


MeadCo.ScriptX.Print.getFromServer(sPrintHtmlApi, async, onSuccess, onFail)

Call a /printHtml API on the server with GET

Param Type Description
sPrintHtmlApi string the api to call on the connected server
async bool true for asynchronous call, false for synchronous
onSuccess function function to call on success
onFail function function to call on failure


MeadCo.ScriptX.Print.printHtml(contentType, content, htmlPrintSettings, fnDone, fnProgress, data) ⇒ boolean

Post a request to the server to print some html and monitor the print job to completion. If the server prints to file then the file is opened for the user (in a new window)

Param Type Description
contentType ContentType enum type of content given (html snippet, url)
content string the content - a url, html snippet or complete html
htmlPrintSettings object the html settings to use such as headers and footers, device settings (printer to use, copies etc) are taken from this static
fnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnProgress function function to call when job status is updated
data any object to give pass to fnProgress

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.Print.printPdf(document, pdfPrintSettings, fnDone, fnProgress, data) ⇒ boolean

Post a request to the server to print some html and monitor the print job to completion. If the server prints to file then the file is opened for the user (in a new window)

Param Type Description
document string full url to the pdf document to be printed
pdfPrintSettings object the settings to use such as rotation, scaling. device settings (printer to use, copies etc) are taken from this static
fnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnProgress function function to call when job status is updated
data any object to give pass to fnProgress

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.Print.printDirect(contentType, content, fnDone) ⇒ boolean

Post a request to the server to print a string directly to the current printer. The print is synchronous at the server and is completed (sent to the printer) when the api returns.

Param Type Description
contentType ContentType enum type of content given (string or url)
content string the content - a url, or string containing e.g. zpl.
fnDone function function to call when printing complete, arg is null on no error, else error message

Returns: boolean - - true if a print was started (otherwise an error will be thrown) *

MeadCo.ScriptX.Print.parseAjaxError(logText, jqXhr, textStatus, errorThrown) ⇒ string

Extract the error text from jQuery AJAX response

Param Type Description
logText string The lead-in text for a console.log entry
jqXhr object jQuery ajax header
textStatus string textStatus result determined by jQuery
errorThrown string The server exception dewtermined by jQuery

Returns: string - The error text to display

MeadCo.ScriptX.Print.reportError(errorTxt)

'derived' classes call this function to report errors, will either throw or report depending on value of onErrorAction.

Param Type Description
errorTxt string the error text to display


MeadCo.ScriptX.Print.reportServerError(errorTxt)

overridable function for reporting an error. 'derived' classes call this function to report errors.

Param Type Description
errorTxt string the error text to display js // overload cloud print library report error MeadCo.ScriptX.Print.reportServerError = function (errorTxt) { app.Messages.PrintErrorBox(errorTxt); }


MeadCo.ScriptX.Print.reportFeatureNotImplemented(featureDescription)

overridable function for reporting an implementation isnt available. 'derived' classes call this function to report functions that are not yet implemented.

Param Type Description
featureDescription string descriptn of the feature that isnt available js // overload cloud print library report error MeadCo.ScriptX.Print.reportFeatureNotImplemented = function (featureDescription) { app.Messages.PrintErrorBox(featureDescription + " is not available yet with the ScriptX.Services.\n\nThis feature will be implemented soon."); }


MeadCo.ScriptX.Print.ensureSpoolingStatus() ⇒ object

Make sure that spooling status is locked active while asynchronous UI that may start printing is displayed by placing a lock on the queue.

Returns: object - a fake job to lock the spooling status on
Example

var lock = MeadCo.ScriptX.Print.ensureSpoolingStatus
ShowAsyncUI(function() {
 MeadCo.ScriptX.Print.freeSpoolStatus(lock);
});


MeadCo.ScriptX.Print.freeSpoolStatus(lock)

Remove a lock on the queue that was created by a call to ensureSpoolingStatus().

Param Type Description
lock object the lock object returned by ensureSpoolingStatus()


MeadCo.ScriptX.Print.waitForSpoolingComplete(iTimeout, fnComplete)

Start (asynchronous) monitor to observe until no more job spooling/waiting at the server then call the given callback function

Param Type Description
iTimeout int wait until complete or timeout (in ms) -1 => infinite
fnComplete function callback function, arg is true if all jobs complete


MeadCo.ScriptX.Print.PageSize

Describe the size of a page by its width and height.

Properties

Name Type Description
width number width of paper in requested units
height number height of paper in requested units


MeadCo.ScriptX.Print.Margins

Describe the margins within which to print.

Properties

Name Type Description
left number left margin in requested units
top number top margin in requested units
right number right margin in requested units
bottom number bottom margin in requested units


MeadCo.ScriptX.Print.DeviceSettingsObject

Information about and the settings to use with an output printing device See also: https://www.meadroid.com/Developers/KnowledgeBank/TechnicalReference/ScriptXServices/WebServiceAPIReference/PrintHtml/deviceinfoGET

Properties

Name Type Description
printerName string The name of the printer
paperSizeName string The descriptive name of the papersize, e.g. "A4"
paperSourceName string The descriptive name of the paper source, e.g. "Upper tray"
collate CollateOptions The collation to use when printing
copies number The number of copies to print
duplex DuplexOptions The dulex printing option
units MeasurementUnits Measurement units for papersize and margins
paperPageSize PageSize The size of the paper (in requested units)
unprintableMargins Margins The margin that cannot be printed in (in requested units)
status number Status code for the status of the device. Note this is not reliable, it is the cached return from the first server enquiry only.
port string Printer connection port name/description
attributes number Printer attributes
serverName string Name of the server to which the printer is connected
shareName string Name of the share
location string description of the location of the printer
isLocal boolean true if the printer is local to the server
isNetwork boolean true if the server is on the network
isShared boolean true if the printer is shared
isDefault boolean true if this is the default printer on the service
bins Array.<string> Array of the names of the available paper sources
forms Array.<string> Array of the names of the avbailable paper sizes


MeadCo.ScriptX.Print.VersionObject

Description of a code version. Semver is used

Properties

Name Type Description
major int The major version
minor int The minor version
build int The patch/hotfix version
revision int Internal revisions of a build/patch/hotfix
majorRevision int ignore
minorRevision int ignore


MeadCo.ScriptX.Print.ServiceDescriptionObject

Information about the service that is connected to - version detail and facilities available

Properties

Name Type Description
ServiceClass ServiceClasses the class of the service; cloud, onpremise, pc
CurrentAPIVersion string the latest version implemented (eg 'v1' or 'v2' etc)
ServiceVersion VersionObject implementation version of the service
ServerVersion VersionObject The version of ScriptX Server used by the service
ServiceUpgrade VersionObject The latest version of the service that is available and later than ServiceVersion/me
AvailablePrinters Array.<string> Array of the names of the available printers
PrintHTML boolean Printing of HTML is supported
PrintPDF boolean Printing of PDF documents is supported
PrintDIRECT boolean Direct printing to a print device is supported


MeadCo.ScriptX.PrintHTML : object

MeadCo.ScriptX.Print.HTML

A static class providing printing of HTML content.

Requires: meadco-core.js, meadco-scriptxprint.js

The purpose of these libraries is to assist those with a body of client javascript code targetting use of the ScriptX Add-On for Internet Explorer. These libraries assist with continuing with a large part of the code intact when transitioning to using ScriptX.Services instead/as well.

Includes processing of calls to the print api that return "printing to file" including collecting the file output.


MeadCo.ScriptX.PrintHTML.documentContentToPrint

Get the complete currently displayed document as string of HTML.

Form values are preserved in the source document then the document cloned.

A base element is created if required. style elements are included. script and object elements are not included.

Properties

Name Type Description
documentContentToPrint string the current content in the window document as html


MeadCo.ScriptX.PrintHTML.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


MeadCo.ScriptX.PrintHTML.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


MeadCo.ScriptX.PrintHTML.PageMarginUnits : enum

Deprecated

Enum to describe the units used on measurements - NOTE please use MeadCo.ScriptX.Print.MeasurementUnits instead

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
INCHES number 1
MM number 2 millimeters


MeadCo.ScriptX.PrintHTML.PageOrientation : enum

Enum to describe the orientation of the paper

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
LANDSCAPE number 1
PORTRAIT number 2


MeadCo.ScriptX.PrintHTML.PrintingPass : enum

Enum to describe the pages to be printed

Read only: true
Properties

Name Type Description
ALL number 1 print all pages
ODD number 2 print odd numbered pages only
EVEN number 3 print even numbered pages only


MeadCo.ScriptX.PrintHTML.BooleanOption : enum

Enum to describe a boolean value or use the default

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
TRUE number 1
FALSE number 2


MeadCo.ScriptX.PrintHTML.frameContentToPrint(sFrame) ⇒ string

Get the complete currently displayed document in a frame as string of HTML.

Form values are preserved in the source document then the document cloned.

A base element is created if required. style elements are included. script and object elements are not included.

Param Type Description
sFrame string the name of the frame

Returns: string - the current content in the frame window document as html

MeadCo.ScriptX.PrintHTML.printDocument(fnCallOnDone, fnCallback, data) ⇒ boolean

Print the complete current document in the window using the settings made by property updates before this function is called.

Param Type Description
fnCallOnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnCallback function function to call when job status is updated
data any object to give pass to fnCallback

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.PrintHTML.printFrame(sFrame, fnCallOnDone, fnCallback, data) ⇒ boolean

Print the complete current document in the named iframe using the settings made by property updates before this function is called.

Param Type Description
sFrame string the name of the iframe whose content is to be printed.
fnCallOnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnCallback function function to call when job status is updated
data any object to give pass to fnCallback

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.PrintHTML.printFromUrl(sUrl, fnCallOnDone, fnCallback, data) ⇒ boolean

Print the document obtained by downloading the given url using the settings made by property updates before this function is called.

Param Type Description
sUrl string the fully qualified url to the document to be printed.
fnCallOnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnCallback function function to call when job status is updated
data any object to give pass to fnCallback

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.PrintHTML.printHtml(sHtml, fnCallOnDone, fnCallback, data) ⇒ boolean

Print the fragment of html using the settings made by property updates before this function is called.

Param Type Description
sHtml string fragment/snippet of html to print, must be complete HTML document.
fnCallOnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnCallback function function to call when job status is updated
data any object to give pass to fnCallback

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.PrintHTML.connectLite(serverUrl, licenseGuid)

Specify the server and the subscription/license id to use on AJAX calls. No call is made in this function

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier


MeadCo.ScriptX.PrintHTML.connect(serverUrl, licenseGuid, onFail)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain default soft html and device settings for the default device as well as the list of available printers.

This call is not required if client side code doesnt need to know about available printers but can assume (at least .connectLite() is required).

This call is synchronous and therefore not recommended. Use connectAsync()

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier
onFail function the function to call if an error occurs when making the connection


MeadCo.ScriptX.PrintHTML.connectAsync(serverUrl, licenseGuid, resolve, reject)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain default soft html and device settings for the default device as well as the list of available printers.

This call is not required if client side code doesnt need to know about available printers but can assume (at least .connectLite() is required).

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier
resolve function function to call on success
reject function function to call on failure


MeadCo.ScriptX.PrintHTML.Margins

Properties

Name Type Description
left number left margin in requested units
top number top margin in requested units
right number right margin in requested units
bottom number bottom margin in requested units


MeadCo.ScriptX.PrintHTML.PageSettings

Properties

Name Type Description
orientation PageOrientation orientation of the paper (size and source is a device setting)
units MeasurementUnits measurement units for margins
margins Margins margins to use


MeadCo.ScriptX.PrintHTML.ExtraHeaderAndFooterSettings

Properties

Name Type
allPagesHeader string
allPagesFooter string
firstPageHeader string
firstPageFooter string
extraFirstPageFooter string
allHeaderHeight number
allFooterHeight number
firstHeaderHeight number
firstFooterHeight number
extraFirstFooterHeight number


MeadCo.ScriptX.PrintHTML.Settings

The soft settings to use when printing html content - headers, footers and margins (Device settings such as papersize, printer are described with MeadCo.ScriptX.Print.deviceSettings)

Properties

Name Type Description
header string Page header for all pages.
footer string Page footer for all pages.
headerFooterFont string description of font to use for header/footer
viewScale number the scaling to use when printing expressed as a percentage. -1 => scale to fit
locale string language/locale - used for formatting date/time values in header/footer. defaults to client browser setting
timezoneOffset number client browser timezone offset so server will print correct time
shortDateFormat string formating string for short dates, if not provided then uses the locale default, or the server default
longDateFormat string formating string for long dates, if not provided then uses the locale default, or the server default
printBackgroundColorsAndImages BooleanOption True if background colours and images are to be printed.
page PageSettings orientation and margins to use on the paper
extraHeadersAndFooters ExtraHeaderAndFooterSettings enhanced headers and footers
pageRange string the (set of) page ranges to print, if empty, print all.
printingPass PrintingPass print all, or odd or even only?
jobTitle string description to use on the job in the print queue
documentUrl string the document url to use in headers and footers


MeadCo.ScriptX.PrintLicensing : object

MeadCo.ScriptX.Print.Licensing

A static class wrapping calls to the server API to install / manage a client license for ScriptX.Services for Windows PC.

The purpose of these libraries is to assist those with a body of client javascript code targetting use of the ScriptX Add-On for Internet Explorer. These libraries assist with continuing with a large part of the code intact when transitioning to using ScriptX.Services instead/as well.

This module is only required when working with ScriptX Services for Windows PC.

A license must be 'applied' to the current html document/window before calls to printing APIs that use the license can be made.

This module is NOT required when working with Cloud or On Premise services as the license installation and management occurs at the server.

Requires: meadco-core.js


MeadCo.ScriptX.PrintLicensing.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


MeadCo.ScriptX.PrintLicensing.result

Get the result code for the last attempt to apply a license.

Basically faked for the benefit of code compatibility with the add-on

Properties

Name Type
result number


MeadCo.ScriptX.PrintLicensing.validLicense

Get whether a license has been applied successfully

Properties

Name Type
validLicense boolean


MeadCo.ScriptX.PrintLicensing.License

Get the details on the connected license. If it hasnt been applied yet, then query for the details (but dont apply it and connectLite() MUST have been called).

Warning this function is synchronous, GetLicenseAsync() should be used.

Properties

Name Type
License license


MeadCo.ScriptX.PrintLicensing.connect(serverUrl, slicenseGuid)

Specify the server to use and the license Guid.

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
slicenseGuid string the license GUID as provided by MeadCo. Optional unless will call GetLicenseAsync() without calling apply


MeadCo.ScriptX.PrintLicensing.connectLite(serverUrl, slicenseGuid, revision, path)

Specify the server to use and the license Guid in order to get details on the license via the License property or function GetLicenseAsync()

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
slicenseGuid string the license GUID as provided by MeadCo. Optional unless will call GetLicenseAsync() without calling apply
revision number the revision number of the licsnse as provided by MeadCo.
path string fully qualified path to the license file (.mlf file). Use the value 'warehouse' to download from the public MeadCo License warehouse


MeadCo.ScriptX.PrintLicensing.apply(licenseGuid, revision, path) ⇒ license

Apply (make usable) the MeadCo ScriptX Client license for use with this content. If the license is not already cached it will be downloaded and cached. It is strongly suggested you request that the silent option is enabled in the license (it is by default for ScriptX.Services for Windows PC licenses)

The license must list the url of the content to which it is being applied.

This call is synchronous and therefore not recommended. Use applyAsync()

Param Type Description
licenseGuid string the license GUID as provided by MeadCo.
revision number the revision number of the licsnse as provided by MeadCo.
path string fully qualified path to the license file (.mlf file). Use the value 'warehouse' to download from the public MeadCo License warehouse

Returns: license - details the license that was sucessfully applied, null if none available

MeadCo.ScriptX.PrintLicensing.applyAsync(licenseGuid, revision, path, resolve, reject)

Apply (make usable) the MeadCo ScriptX Client license for use with this content. If the license is not already cached it will be downloaded and cached. It is strongly suggested you request that the silent option is enabled in the license (it is by default for ScriptX.Services for Windows PC licenses)

The license must list the url of the content to which it is being applied.

Param Type Description
licenseGuid string the license GUID as provided by MeadCo.
revision number the revision number of the licsnse as provided by MeadCo.
path string fully qualified path to the license file (.mlf file). Use the value 'warehouse' to download from the public MeadCo License warehouse
resolve function function to call on success
reject function function to call on failure with reason for failure


MeadCo.ScriptX.PrintLicensing.GetLicenseAsync(resolve, reject)

Get the details on the connected license. If it hasnt been applied yet, then query for the details (but dont apply it and connectLite() MUST have been called).

Param Type Description
resolve function function to call on success
reject function function to call on failure with reason for failure


MeadCo.ScriptX.PrintLicensing.LicenseOptions

The capabilities that can be licensed.

Properties

Name Type Description
basicHtmlPrinting boolean True if Add-on compatible basic html printing is available (always true)
advancedPrinting boolean True if Add-on compatible advanced html printing features are available
enhancedFormatting boolean True if Add-on compatible enhanced formatting is available
printPdf boolean True if printing PDF files is available
printRaw boolean True if Raw printing is available


MeadCo.ScriptX.PrintLicensing.license

License details

Properties

Name Type Description
guid string The unique id of the license
company string The name of the license owner
companyHomePage string Url of company home page
from Date Date license is valid from
to Date Date license is vaid till
options LicenseOptions The options enabled by the license
domains Array.string the domains the license can be used from


MeadCo.ScriptX.PrintPDF : object

MeadCo.ScriptX.Print.PDF

A static class providing printing of PDF files.

Requires:

  • meadco-core.js
  • meadco-scriptxprint.js

The purpose of these libraries is to assist those with a body of client javascript code targetting use of the ScriptX Add-On for Internet Explorer. These libraries assist with continuing with a large part of the code intact when transitioning to using ScriptX.Services instead/as well.

Includes processing of calls to the print api that return "printing to file" including collecting the file output.


MeadCo.ScriptX.PrintPDF.PageOrientation : enum

Enum to describe the orientation of the paper

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
LANDSCAPE number 1
PORTRAIT number 2


MeadCo.ScriptX.PrintPDF.BooleanOption : enum

Enum to describe a boolean value or use the default

Read only: true
Properties

Name Type Description
DEFAULT number 0 use the default at the print server
TRUE number 1
FALSE number 2


MeadCo.ScriptX.PrintPDF.PdfPageScaling : enum

Enum to describe the page scaling to perfor,

Read only: true
Properties

Name Type Description
UNDEFINED number Not specified (ShrinkToFit is used instead)
NONE number No scaling
FITTOPAPER number Scale up to fit to paper if document is smaller than the paper
SHRINKLARGEPAGES number Only scale to fit oversized pages


MeadCo.ScriptX.PrintPDF.PdfPrintQuality : enum

Enum to describle the print quality of images

Read only: true
Properties

Name Type Description
NORMAL number Normal quality
HIGH number High quality
LOSSLESS number Highest quality


MeadCo.ScriptX.PrintPDF.resetSettings()

Reset the soft settings to use when printing PDF content to default.


MeadCo.ScriptX.PrintPDF.print(sUrl, fnCallOnDone, fnCallback, data) ⇒ boolean

Print the document obtained by downloading the given url, use the current settings to control the rendering.

Param Type Description
sUrl string the fully qualified url to the PDF document to be printed.
fnCallOnDone function function to call when printing complete (and output returned), arg is null on no error, else error message.
fnCallback function function to call when job status is updated
data any object to give pass to fnCallback

Returns: boolean - - true if a print was started (otherwise an error will be thrown)

MeadCo.ScriptX.PrintPDF.connectLite(serverUrl, licenseGuid)

Specify the server and the subscription/license id to use on AJAX calls. No call is made in this function

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier


MeadCo.ScriptX.PrintPDF.connect(serverUrl, licenseGuid)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain device settings for the default device as well as the list of available printers.

This call is not required if client side code doesnt need to know about available printers but can assume. It also is not required if MeadCo.ScriptX.Print.HTML.connectAsync has been called.

This call is synchronous and therefore not recommended. Use connectAsync()

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier


MeadCo.ScriptX.PrintPDF.connectAsync(serverUrl, licenseGuid, resolve, reject)

Specify the server to use and the subscription/license id.

Attempt to connect to the defined ScriptX.Services server and obtain device settings for the default device as well as the list of available printers.

This call is not required if client side code doesnt need to know about available printers but can assume. It also is not required if MeadCo.ScriptX.Print.HTML.connectAsync has been called.

Param Type Description
serverUrl string the 'root' url to the server (the api path will be added by the library)
licenseGuid string the license/subscription identifier
resolve function function to call on success
reject function function to call on failure


MeadCo.ScriptX.PrintPDF.Settings

The soft settings to use when printing PDF content - options controlling the rendering of the content. (Device settings such as papersize, printer are described with MeadCo.ScriptX.Print.deviceSettings)

Properties

Name Type Description
jobDescription string Optional description for the print which will be used as the jobname in the printer queue
pageRange string The rage of pages to print. Empty means all, or from-to or comma delimited sets of from-to
shrinkToFit BooleanOption Shrink the PDF page to fit the paper, optional true by default
pageScaling PdfPageScaling If given then shrinkToFit is ignored and this scaling is used.
autoRotateCenter BooleanOption Indicates whether pages should be rotated to fit on the paper and centered. If this parameter is not given then it will be set to true if shrinkToFit is true or pageScaling is FITTOPAPER.
orientation PageOrientation Required oritentation on the printed paper
monochrome boolean Specifies if monochrome printing should be used. This option is known not to work with some HP printers due to issues in HP print drivers.
normalise boolean Indicates whether or not the pages should be processed to ensure drawing operations are at the expected positions. This option may assist if documents do not print as required.


secmgr : object

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

The MeadCo Security Manager Add-on for Internet Explorer is included on a html document with an <object id='secmgr' /> element with a de-facto standard id of 'secmgr'.

The object is referenced with the property window.secmgr which exposes properties and methods.

The MeadCo Security Manager Add-on for Internet Explorer provided for prompting the user to accept use of the license that enabled advanced features of ScriptX.Add-on. Frequently there was then no further reference to Security Manager and in such cases this shim is not required.

This use case can be emulated by using appropriate attributes on an element (for example a <script></script>) on the page and including meadco-scriptxprint.js to process the attributes. This shim is then not required.

Please note that when working with ScriptX.Services for Windows PC meadco-scriptxprintlicensing.js is required even with the use of attributes.

This shim is required if you have code that relies upon being able to inspect the availability of a license.

Full documentation on the properties/methods is provided by the technical reference documentation for the ScriptX Add-on for Internet Explorer: https://www.meadroid.com/Developers/KnowledgeBank/TechnicalReference/ScriptXAddOn/secmgr. That documentation is not reproduced here.

If the startup script determines that the MeadCo Security Manager 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 (https://github.com/MeadCo/MeadCoScriptXJS) 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.js meadco-scriptxprint.js meadco-scriptxprintlicensing.js


secmgr.version

Get the version of this module as a string major.minor.hotfix.build

Properties

Name Type
version string


secmgr.GetLicenseAsync(resolve, reject)

Get the details of the license using Asynchronous calls to the server. See meadco-scriptxprintlicensing.js for more detail

Param Type Description
resolve function function to call on successfulk completion
reject function function to call on failure with reason for failure

results matching ""

    No results matching ""