Methods
(static) this.advanceBlackMark(successFunction, errorFunction)
Provides blackmark sensor calibration by scaning 200mm of paper for possible black marks and adjust the sensor treshold. Make sure you have put the right paper before calling this function.
Parameters:
| Name | Type | Description |
|---|---|---|
successFunction |
function | Success function |
errorFunction |
function | Error function |
- Source:
(static) this.feedPaper(amountmm, onFailure)
Feeds the paper to leave blank space between prints or to allow the paper to be teared.
Parameters:
| Name | Type | Description |
|---|---|---|
amountmm |
number | Amount of millimeters to feed the paper. Passing 0 will feed the paper the nessesary amount so it can be teared by the user. |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
Example
// Feeds the paper 1cm
QBrowser.Printer.feedPaper(10, PrintFailed);
// Feeds the paper so it can be teared
QBrowser.Printer.feedPaper(0, PrintFailed);
(static) this.flushCache(onFailure)
Forces data still in the sdk buffer to be sent directly to the printer
Parameters:
| Name | Type | Description |
|---|---|---|
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
(static) this.monitorStatus(printerStatus)
Helper function to monitor the status of the supported printers. This function is used to receive realtime notifications when supported printer becomes available.
Parameters:
| Name | Type | Description |
|---|---|---|
printerStatus |
function | Callback function that receives the printers status updates, that includes if printers paper is out, or battery is low. Parameters: info(object) - info.connected(boolean) - indicates if supported printer is connected - info.name(string) - printer name - info.version(string) - printer firmware version - info.outOfPaper(boolean) - true if printer is out of paper, false otherwise - info.lowBattery(boolean) - true if printers battery level is dangerously low |
- Source:
Example
function PrinterStatus(info)
{
if(info.connected==true)
document.body.innerHTML+="Connected printer <b>"+info.name+" "+info.version+"</b><br/>";
if(info.connected==false)
document.body.innerHTML+="Printer disconnected<br/>";
if(info.outOfPaper==true)
document.body.innerHTML+="Out of paper<br/>";
if(info.outOfPaper==false)
document.body.innerHTML+="Printer paper loaded<br/>";
if(info.lowBattery==true)
document.body.innerHTML+="Low battery<br/>";
if(info.lowBattery==false)
document.body.innerHTML+="Battery levels good<br/>";
}
QBrowser.Printer.monitorStatus(PrinterStatus);
(static) this.printBarcode(type, barcode, onFailure, settings)
Prints a barcode on the printer with various styles and sizes.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
number | Barcode type to print, please do not confuse this with the barcode type from scanning functions. Available print barcode types: - QBrowser.BarcodePrintType.UPCA - prints UPC-A barcode - QBrowser.BarcodePrintType.UPCE - prints UPC-E barcode - QBrowser.BarcodePrintType.EAN13 - prints EAN-13 barcode - QBrowser.BarcodePrintType.EAN8 - prints EAN-8 barcode - QBrowser.BarcodePrintType.CODE39 - Prints Code 39 barcode - QBrowser.BarcodePrintType.ITF - prints ITF barcode - QBrowser.BarcodePrintType.CODABAR - prints CODABAR barcode - QBrowser.BarcodePrintType.CODE93 - prints Code 93 barcode - QBrowser.BarcodePrintType.CODE128 - prints CODE128 barcode - QBrowser.BarcodePrintType.PDF417 - Prints 2D PDF-417 barcode - QBrowser.BarcodePrintType.CODE128AUTO - prints CODE128 optimized barcode, supported only on DPP-250, DPP-350 and PP-60 printers, it makes the barcode lot smaller especially when numbers only are used - QBrowser.BarcodePrintType.EAN128AUTO - prints EAN128 optimized barcode, supported only on DPP-250, DPP-350 and PP-60 printers, it makes the barcode lot smaller especially when numbers only are used |
barcode |
string | Barcode data to print. Please note, that every barcode have specific requirements about the data - be that length, symbols that can be printed, tables to pick from, etc, consult barcode type documentation if some barcode refuses to print |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
settings |
object | Additional optional barcode settings. Supported settings are: - align(number) - barcode horizontal alignment, one of: - > QBrowser.Align.LEFT - left alignment - > QBrowser.Align.CENTER - centered - > QBrowser.Align.RIGHT - right alignment - height(number) - barcode height in millimeters, default is 9 - hri(number) - HRI position |
- Source:
(static) this.printBase64Image(image, onFailure)
Prints Base64 encoded image
Parameters:
| Name | Type | Description |
|---|---|---|
image |
object | Image to print |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
(static) this.printImage(image, onFailure)
Prints image. The image is converted to black & white using dithering to preserve image quality.
Parameters:
| Name | Type | Description |
|---|---|---|
image |
object | Image to print |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
Example
QBrowser.Printer.printImage(document.getElementsByName("Image")[0], PrintFailed);
(static) this.printLogo(onFailure)
Prints the logo, previously stored in the printer. If the printer does not support, of have no logo set, nothing is printed.
Parameters:
| Name | Type | Description |
|---|---|---|
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
(static) this.printText(text, onFailure)
Prints text on the printer with various styles and font sizes.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Text to print. The text string can contain control symbols that define styles, font sizes, alignment. Available styles: - {==} - reverts all settings to their defaults. That includes font size, style, intensity, aligning - {=Fx} - selects font size. x ranges from 0 to 7 as follows: - * 0 - FONT_9X16 - * 1 - FONT_9X32 - * 2 - FONT_18X32 - * 3 - FONT_12X24 - * 4 - FONT_24X24 - * 5 - FONT_12X48 - * 6 - FONT_24X48 - {=L} - left text aligning - {=C} - center text aligning - {=R} - right text aligning - {=Rx} - text rotation as follows: - * 0 - not rotated - * 1 - rotated 90 degrees - * 2 - rotated 180 degrees - {=Ix} - sets intensity level as follows: - * 0 - intensity 70% - * 1 - intensity 80% - * 2 - intensity 90% - * 3 - intensity 100% - * 4 - intensity 120% - * 5 - intensity 150% - {+/-B} - sets or unsets bold font style - {+/-I} - sets or unsets italic font style - {+/-U} - sets or unsets underline font style - {+/-V} - sets or unsets inverse font style - {+/-W} - sets or unsets text word-wrapping |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source:
Example
QBrowser.Printer.printText("{=C}FONT SIZES\n{=L}{=F0}Font 9x16\n{=F1}Font 18x16\n{=F2}Font 9x32\n{=F3}Font 18x32\n",PrintFailed);
QBrowser.Printer.printText("{=F4}Font 12x24\n{=F5}Font 24x24\n{=F6}Font 12x48\n{=F7}Font 24x48\n\n",PrintFailed);
QBrowser.Printer.printText("{=C}FONT STYLES\n{=L}Normal\n{+B}Bold\n{+I}Bold Italic{-I}{-B}\n{+U}Underlined{-U}\n{+V}Inversed{-V}\n\n",PrintFailed);
QBrowser.Printer.printText("{=C}FONT ROTATION\n{=L}{=R1}Rotated 90 degrees\n{=R2}Rotated 180 degrees\n\n",PrintFailed);
QBrowser.Printer.printText("{+W}{=F0}This function demonstrates the use of the built-in word-wrapping capability\n",PrintFailed);
(static) this.tiffImage(image, onFailure)
Prints tiff image
Parameters:
| Name | Type | Description |
|---|---|---|
image |
object | Image to print |
onFailure |
function | Error function. Format: onFailure(errorCode, errorDescription) |
- Source: