MeadCo.ScriptX.Print.HTML

Namespace

MeadCo.ScriptX.Print.HTML

MeadCo.ScriptX.Print.HTML

A static class providing printing of HTML content.

Description:
  • 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.

Source:

Members

(static) documentContentToPrint

Get the complete currently displayed document as string of HTML.

Description:
  • 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.

Source:
Properties:
Name Type Description
documentContentToPrint string

the current content in the window document as html

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.

(static) version

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

.

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

Source:
Properties:
Name Type Description
version string

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

(static) version

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

.

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

Source:
Properties:
Name Type Description
version string

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

Methods

(static) connect(serverUrl, licenseGuid, onFail)

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

Description:
  • 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()

Source:
Parameters:
Name 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

(static) connectAsync(serverUrl, licenseGuid, resolve, reject)

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

Description:
  • 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).

Source:
Parameters:
Name 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

(static) connectLite(serverUrl, licenseGuid)

Specify the server and the subscription/license id to use on AJAX calls.

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

Source:
Parameters:
Name 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

(static) frameContentToPrint(sFrame) → {string}

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

Description:
  • 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.

Source:
Parameters:
Name Type Description
sFrame string

the name of the frame

Returns:

the current content in the frame window document as html

Type
string

(static) previewDocument()

Display a preview of the document as it will be printed.

Description:
  • Display a preview of the document as it will be printed.

Source:

(static) previewFrame(sFrame)

Display a preview of the frame content document it will be printed.

Description:
  • Display a preview of the frame content document it will be printed.

Source:
Parameters:
Name Type Description
sFrame string

the name of the iframe whose content is to be printed.

(static) 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.

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

Source:
Parameters:
Name 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:
  • true if a print was started (otherwise an error will be thrown)
Type
boolean

(static) 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.

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

Source:
Parameters:
Name 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:
  • true if a print was started (otherwise an error will be thrown)
Type
boolean

(static) 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.

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

Source:
Parameters:
Name 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:
  • true if a print was started (otherwise an error will be thrown)
Type
boolean

(static) printHtml(sHtml, fnCallOnDone, fnCallback, data) → {boolean}

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

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

Source:
Parameters:
Name 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:
  • true if a print was started (otherwise an error will be thrown)
Type
boolean

Type Definitions

BooleanOption

Enum to describe a boolean value or use the default

.

Description:
  • Enum to describe a boolean value or use the default

Source:
Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

TRUE number

1

FALSE number

2

Enum to describe a boolean value or use the default

Type:
  • number

ExtraHeaderAndFooterSettings

Source:
Properties:
Name Type Description
allPagesHeader string
allPagesFooter string
firstPageHeader string
firstPageFooter string
extraFirstPageFooter string
allHeaderHeight number
allFooterHeight number
firstHeaderHeight number
firstFooterHeight number
extraFirstFooterHeight number

Margins

Source:
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

PageMarginUnits

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

.

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

Source:
Deprecated:
  • Yes
Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

INCHES number

1

MM number

2 millimeters

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

Type:
  • number

PageOrientation

Enum to describe the orientation of the paper

.

Description:
  • Enum to describe the orientation of the paper

Source:
Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

LANDSCAPE number

1

PORTRAIT number

2

Enum to describe the orientation of the paper

Type:
  • number

PageSettings

Source:
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

PrintingPass

Enum to describe the pages to be printed

.

Description:
  • Enum to describe the pages to be printed

Source:
Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

ALL number

1 print all pages

ODD number

2 print odd numbered pages only

EVEN number

3 print even numbered pages only

Enum to describe the pages to be printed

Type:
  • number

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)

.

Description:
  • 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)

Source:
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

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)