Different papers sizes on Zebra printers

I'm trying to print labels with Zebra Browser Print. What I'm trying to figure out is how to support different papers size for printing the same label. Any ideas to achieve this ?

 

 

var available_printers = null;

var selected_category = null;

var default_printer = null;

var selected_printer = null;

var format_start = "^XA^LL200^FO80,50^A0N36,36^FD";

var format_end = "^FS^XZ";

var default_mode = true;        

 

 

var labelText = "^XA^PW400^LL400^PON^FO0,10^A0,20,20^FD" + firstLine

                      + "^FS^FO0,50^A0,15,15^FD" + secondLIne +      "^FS^FO0,90^A0,15,15^FD,"

                      + thirdLine + "," + "^FS^FO0,130^A0,15,15^FD" + fourthLine

                      + "^FS^FO0,150^A0,15,15^FD" + fifthLine + "^FS"

                      + "^FO0,180^BY3^B8N,50,Y,N^FD"+barcode+"^FS"

                      + "^XZ";

 

 

      sendData(labelText);

 

 

 

 

function sendData(sDivText)

{

showLoading("Printing...");

checkPrinterStatus(function (text) {

 

 

    selected_printer.send(format_start + sDivText + format_end,  printComplete, printerError);

 

 

 

 

});

Manuel Caicedo-...
Hi Carlo,With the correct DPI

Hi Carlo,

With the correct DPI and the correct model printer you can adjust the size of the label format to fit the paper size, so you can a have a label format for a 200 DPI, another label format for a 300 DPI, and one more for 600 DPI. You can have these as static versions or you can develop an algorithm to adjust them in running time. With the printer model you easily can identify the maximum print width, so if this printer is a 2", 3", 4" or 6" width.

How can you identify the DPI of the printer, and the model of the printer?  Ok, there is a simple ZPL command that allows you to define what type of printer and dpi you have. "~HI". More information in how to use this command. Please, go the link below pag. 196.

https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf

You could also use a SGD command like the "head.resolution.in_dpi", but it only works for Link-OS printers. Page 717, in the ZPL programming guide.

The advantage of Browser Print driver is the bi-directional capability, so you can make these requests to the printer, and the printer will give you the information you need for solving the problem. The below JavaScript function will help you to implement the logic you need to difference the dpi and send the right label format to the printer you are using at that moment. You can infere how we use the JavaScript function to implement the checking Printer status.

sendThenRead(dataToSend, finishedCallback, errorCallbackopt)

Send data to the device, then read a response back

Parameters:
Name Type Attributes Description
dataToSend   string The data to be sent to the device
finishedCallback   function The function that is called when reading is completed.
errorCallback   function   <optional> The function that is called when an error occurs while sending or reading data.
Here an example with the command "~HQES":

function checkPrinterStatus(finishedFunction)

{

  selected_printer.sendThenRead("~HQES",

  function(text){

  var that = this;

  var statuses = new Array();

  var ok = false;

  var is_error = text.charAt(70);

  var media = text.charAt(88);

  var head = text.charAt(87);

  var pause = text.charAt(84);

  // check each flag that prevents printing

  if (is_error == '0')

  {

  ok = true;

  statuses.push("Ready to Print");

  }

  if (media == '1')

  statuses.push("Paper out");

  if (media == '2')

  statuses.push("Ribbon Out");

  if (media == '4')

  statuses.push("Media Door Open");

  if (media == '8')

  statuses.push("Cutter Fault");

  if (head == '1')

  statuses.push("Printhead Overheating");

  if (head == '2')

  statuses.push("Motor Overheating");

  if (head == '4')

  statuses.push("Printhead Fault");

  if (head == '8')

  statuses.push("Incorrect Printhead");

  if (pause == '1')

  statuses.push("Printer Paused");

  if ((!ok) && (statuses.Count == 0))

  statuses.push("Error: Unknown Error");

  finishedFunction(statuses.join());

  }, printerError);

};

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Carlo De Filippo
Hi Manuel,many thanks for

Hi Manuel,

many thanks for your exhaustive response.

I've a ZEBRA TLP 2844 and when I use selected_printer.sendThenRead("~HQES"... to make request to the printer, it seems to produce a code not recognised for the script checking the printer status (I see that it checks: var media = text.charAt(88), but I've noticed that the bit string is not corresponding to the real printer status (infact, the javascript always give me a write error if I do this control).

Maybe the ZEBRA TLP 2844 is not supported for the browser printing ?

Greeetings,

Carlo

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Carlo,Yes, you are right,

Hi Carlo,

Yes, you are right, Browser Print does not support TLP 2844 printer. This printer is already discontinued and it is not supported any more. For more information about this printer, please, review the link below.

TLP 2844 Desktop Printer Support & Downloads | Zebra

The replacement printer for the TLP 2844 is the GC420 printer.

Value Desktop Printers | Zebra

If you want to know what printers are supported actually with Browser Print, please, review the link below. It is possible that in future releases, we will add more printers to the supported list.

Browser Print SDK | Link-OS | Zebra

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments