new Printer(device)
Represents a Zebra Printer, wrapping the BrowserPrint.Device class
Client API Level 2Parameters:
Name | Type | Description |
---|---|---|
device |
BrowserPrint.Device | BrowserPrint.Device object describing this device |
Classes
Methods
clearRequestQueue()
Clears all remaining requests in the queue. This does not cancel the currently running request
getConfiguration(successopt, failureopt) → {Promise}
Queued
Sends a request to the printer, then builds and returns Zebra.Printer.Configuration object from the response. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
success |
function |
<optional> |
A callback function on success, which has the Zebra.Printer.Configuration object passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
getConvertedResource(resource, optionsopt, successopt, failureopt) → {Promise}
Retrieves the resource and converts it into a printable form. Converted resource will be returned as string with a format dependent on printer command language requested and capabilities of the host platform.
Client API Level 4Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resource |
string | blob | The resource to be printed. Accepts a URL as a string, or a blob of an already loaded image file. | |||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Options for converting the resource provided.
Properties
|
||||||||||||||||||||||||||||||||||||
success |
function |
<optional> |
A callback function on success with the converted resource passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead | ||||||||||||||||||||||||||||||||||||
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
getInfo(successopt, failureopt) → {Promise}
Queued
Sends a request to the printer, then builds and returns a Zebra.Printer.Info object from response. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
success |
function |
<optional> |
A callback function on success, which has the Zebra.Printer.Info object passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
getSGD(setting, successopt, failureopt) → {Promise}
Queued
Get the value of an 'SGD' setting. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
setting |
string | The 'SGD' setting to retrieve | |
success |
function |
<optional> |
A callback function on success, which has the value of the setting passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
getStatus(successopt, failureopt) → {Promise}
Queued
Sends a request to the printer, then builds and returns a Zebra.Printer.Status object from response. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
success |
function |
<optional> |
A callback function on success, which has the Zebra.Printer.Status object passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
isPrinterReady(successopt, failureopt) → {Promise}
Checks and reports whether the printer is ready to print.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
success |
function |
<optional> |
A callback function called if the printer is ready to print, passing the status message. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function called if the printer is not ready to print, passing the error message, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
printImageAsLabel(resource, optionsopt, successopt, failureopt) → {Promise}
Prints an image resource as a label, automatically resizing the image to best fill the print width and label length. Image will be scaled to the largest possible size while still entirely fitting within the printable area of the label, according to the Zebra.Printer.Configuration retrieved from the printer. This function requires that the API has successfully retrieved the printer configuration before calling.
Client API Level 4Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resource |
string | blob | The resource to be printed. Accepts a URL as a string, or a blob of an already loaded image file. | |||||||||||||||||
options |
object |
<optional> |
Options for converting the resource.
Properties
|
||||||||||||||||
success |
function |
<optional> |
A callback function on success. Omitting the success and failure callbacks will automatically setup a Promise instead | ||||||||||||||||
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
query(command, successopt, failureopt) → {Promise}
Queued
Sends a command to the printer, then reads back the response. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
command |
string | The query command to send to the printer | |
success |
function |
<optional> |
A callback function on success, which has the Zebra.Printer.Status object passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
setSGD(setting, value, successopt, failureopt) → {Promise}
Queued
Sets an 'SGD' settings value on the printer. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
setting |
string | The setting to set the value of | |
value |
string | The value the setting should be set to | |
success |
function |
<optional> |
A callback function on success. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
setThenGetSGD(setting, value, successopt, failureopt) → {Promise}
Queued
Set, then Get the value of an 'SGD' setting. This query to the printer is synchronized so that the last query response is received before this query is sent. This means all synchronized queries will be sent and received in the order they are called.
Client API Level 2Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
setting |
string | The 'SGD' setting to to set and then retrieve | |
value |
string | The value to set the 'SGD' setting to to | |
success |
function |
<optional> |
A callback function on success, which has the value of the setting passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead |
failure |
function |
<optional> |
A callback function on failure. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise
storeConvertedResource(resource, optionsopt, successopt, failureopt) → {Promise}
Retrieves the resource and converts it into a storeable form, storing it on the printer. The path the resource was stored at on the printer will be passed to the success function as a string.
Client API Level 4Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resource |
string | blob | The resource to be stored. Accepts a URL as a string, or a blob of an already loaded image file. | |||||||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Options for converting the provided resource.
Properties
|
||||||||||||||||||||||||||||||||||||||||
success |
function |
<optional> |
A callback function on success with the storage location path passed to it. Omitting the success and failure callbacks will automatically setup a Promise instead | ||||||||||||||||||||||||||||||||||||||||
failure |
function |
<optional> |
A callback function on failure, which has the error message passed to it as a string. Omitting the success and failure callbacks will automatically setup a Promise instead |
Returns:
- Type
- Promise