Module: BrowserPrint

An API for discovering and communicating with local devices from the browser.
Properties:
Name Type Description
BrowserPrint.defaultSuccessCallback ResponseCallback Function that is called if the successCallback is not included for a BrowserPrint operation.
BrowserPrint.defaultErrorCallback ResponseCallback Function that is called if the errorCallback is not included for a BrowserPrint operation.

Methods

(static) BrowserPrint.bindFieldToReadData(device, field, readIntervalopt, onReadCallbackopt)

Continually reads from a device with a specified interval, placing the result of a non-empty read into the value of the field specified.

Client Client API Level 2
Parameters:
Name Type Attributes Description
device Device The device you want to read from
field Object The field you want the read data to be placed in.
readInterval int <optional>
The time between read attempts, defaulting to 1 second.
onReadCallback ResponseCallback <optional>
The function that is called when the read is completed with non empty data.

(static) BrowserPrint.convert(resource, deviceopt, optionsopt, finishedCallbackopt, errorCallbackopt)

Send contents of a url or blob to the application for conversion into a different format.

Client API Level 4
Parameters:
Name Type Attributes Description
resource string The url or blob from which data will be retrieved and converted
device Device <optional>
The device that this command will send the data to, if the options dictate it.
options object <optional>
Options for converting the file.
Properties
Name Type Attributes Description
toFormat string | 'zpl' | 'cpcl' | 'kpl' | 'none' <optional>
The format the file should be converted to. Options are zpl, cpcl, kpl, and none. If 'none' is provided, the resource will not be converted to a different format before sending to or storing on the device. Default value is zpl.
fromFormat string <optional>
The format of the resource provided. If not specified, the application will attempt to determine the format based on the file type or file structure.
action string | 'print' | 'store' | 'return' <optional>
The action to take with the converted data. 'print' will attempt to make the converted resource printable and send it to the printer. 'store' will attempt to make the resource storable and store it at the path provide. 'return' will convert the resource and return it to the browser.
resize.width int <optional>
The width an image resource should be resized to
resize.height int <optional>
The height an image resource should be resized to
fitTo.width int <optional>
Scale an image resource so that it fits into a rectangle described by fitTo.width and fitTo.height, maintaining aspect ratio.
fitTo.height int <optional>
Scale an image resource so that it fits into a rectangle described by fitTo.width and fitTo.height, maintaining aspect ratio.
scale float <optional>
Scale an image resource by the this factor.
featureKey string <optional>
The licensing key for the resource conversion. Currently, only converting from a PDF format requires a licensing key
finishedCallback ResponseCallback <optional>
The function that is called when conversion is complete. The value passed to the function will be the converted resource as a string.
errorCallback ResponseCallback <optional>
The function that is called when an error occurs while converting the resource.

(static) BrowserPrint.getApplicationConfiguration(finishedCallback, errorCallbackopt)

Gets the application configuration.

Client API Level 3
Parameters:
Name Type Attributes Description
finishedCallback ApplicationConfigurationCallback The function that is called when the application configuration is retrieved, passing the ApplicationConfiguration to the function.
errorCallback ResponseCallback <optional>
The function that is called if an error occurs while getting the application configuration, passing the error message to the function if there is one.

(static) BrowserPrint.getDefaultDevice(type, finishedCallback, errorCallbackopt)

Gets the user specified default device by type

Client API Level 2
Parameters:
Name Type Attributes Description
type string The type of the default device to retrieve.
finishedCallback DefaultDeviceCallback The function that is called when a default device is retrieved, passing the device to the function.
errorCallback ResponseCallback <optional>
The function that is called if an error occurs while getting the default device, passing the error message to the function if there is one.

(static) BrowserPrint.getLocalDevices(finishedCallback, errorCallbackopt, typeFilteropt)

Get devices available to the local client

Client API Level 2
Parameters:
Name Type Attributes Description
finishedCallback DiscoveredDevicesCallback The function that is called when finding devices is completed, passing an array of devices to the function.
errorCallback ResponseCallback <optional>
The function that is called if an error occurs while finding devices, passing the error message to the function if there is one.
typeFilter string <optional>
The type of device you are looking for. Not specifying a type will return all devices.

(static) BrowserPrint.loadFileFromUrl(url, finishedCallback, errorCallbackopt)

Retrieves the file at the specified URL and returns it as a blob.

Client Client API Level 2
Parameters:
Name Type Attributes Description
url string The url of the file to retrieve
finishedCallback function The function that is called when the file has been retrieved. The data is passed to the function as a blob
errorCallback ResponseCallback <optional>
The function that is called if an error occurs while retrieving the file.

(static) BrowserPrint.readOnInterval(device, callback, readIntervalopt)

Continually reads from a device with a specified interval

Client API Level 2
Parameters:
Name Type Attributes Description
device Device The device you want to read from
callback ResponseCallback The function that is called when the read is completed with non empty data.
readInterval int <optional>
The time between read attempts, defaulting to 1 second.

(static) BrowserPrint.stopReadOnInterval(device)

Stops continually reading from a device that was registered with readOnInterval or bindFieldToReadData

Client API Level 2
Parameters:
Name Type Description
device Device The device you want to stop reading from

Type Definitions

ApplicationConfigurationCallback(applicationConfiguration)

Callback for getting the application configuration
Parameters:
Name Type Description
applicationConfiguration ApplicationConfiguration

DefaultDeviceCallback(device)

The Callback for receiving the default device
Parameters:
Name Type Description
device BrowserPrint.Device The default device of the type specified. Value will be null if no default device is set.

DiscoveredDevicesCallback(devices)

The callback for receiving discovered devices
Parameters:
Name Type Description
devices Array.<BrowserPrint.Device> The devices that were discovered by the client application

ResponseCallback(response)

The standard response callback
Parameters:
Name Type Description
response string The Response from the communication with the application or device