Namespace

MeadCo.ScriptX.Print.PDF

MeadCo.ScriptX.Print.PDF

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.

View Source meadco-scriptxprintpdf.js, line 1

Methods

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

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

View Source meadco-scriptxprintpdf.js, line 186

# static 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.

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

View Source meadco-scriptxprintpdf.js, line 216

# static connectLite(serverUrl, licenseGuid)

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

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

View Source meadco-scriptxprintpdf.js, line 174

# static print(sUrl, fnCallOnDone, fnCallback, data) → {boolean}

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

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

View Source meadco-scriptxprintpdf.js, line 159

  • true if a print was started (otherwise an error will be thrown)
boolean

# static resetSettings()

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

View Source meadco-scriptxprintpdf.js, line 141

Type Definitions

number

# BooleanOption

Enum to describe a boolean value or use the default

Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

TRUE number

1

FALSE number

2

View Source meadco-scriptxprintpdf.js, line 42

number

# PageOrientation

Enum to describe the orientation of the paper

Properties:
Name Type Description
DEFAULT number

0 use the default at the print server

LANDSCAPE number

1

PORTRAIT number

2

View Source meadco-scriptxprintpdf.js, line 25

number

# PdfPageScaling

Enum to describe the page scaling to perfor,

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

View Source meadco-scriptxprintpdf.js, line 59

number

# PdfPrintQuality

Enum to describle the print quality of images

Properties:
Name Type Description
NORMAL number

Normal quality

HIGH number

High quality

LOSSLESS number

Highest quality

View Source meadco-scriptxprintpdf.js, line 78

# 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.

View Source meadco-scriptxprintpdf.js, line 124