Sample code uses ES6 language features such as arrow functions and promises. For compatibility with IE11, code written with these features must be either transpiled using tools like Babel or refactored accordingly using callbacks.
Introduction
The Trust1Connector print module provides the integrator the ability to communicate with local printers. It provides an interface to retrieve the available printers and then execute a specific print job on one of those printers.
Interface
Below you can find the interface of the Trust1Connector print module.
Model Objects
Below you can find the available models for Trust1Connector print module which are used in the interface.
Get Printer module object
Before we can use the print module we need to Initialise the Trust1Connector. The code sample below is a simplified version, for the complete initialise flow you can see Integration in Web Applications
After you've initialised the Trust1Connector you can use the client/response
of the initialise function to instantiate the rawprint
module. Later on we can keep using this module to execute various print functions provided by the Trust1Connector interface.
In the example below we execute the list
function available in the rawprint
module. Here we use the callback mechanism but a Promise is also available as defined in the interface
List
The list function provides an iterator of all the available printers locally. These will return as identifiers that can be used when executing a print
action as described in the Print function
An example callback:
Response:
Print
The Print function available on the interface provides print capabilities via the Trust1Connector. Here you need to specify the print job name, a name for the printer which can be fetched via the List function and the Data.
The data block needs to be base64 encoded.
An example callback:
The print function will respond with a True
or False
depending on wether the command succeeded or failed.
Last updated