2 devices with one printer

// Expert user has replied.
J Julien PLESNIAK 1 month 2 weeks ago
79 3 0

Hello
We print from our web application to Zebra Print JS and we have a small blockage when 2 tablets use the same printer.
Concrete case:
- The 2 tablets are paired with the printer
- Launch a label print on the first tablet => the printing works
- Launch a print on the second tablet => the printer does not respond. It seems that the first tablet has not released the connection.

At the code level we retrieve the default printer then we launch the printing.

Do you know how to release the connection after a print?

Thanks

 

zebraPrinter.getDefaultDevice("printer", function(device) {
        device.sendFile(pdfBlob, null, function(error) {
          alert('Une erreur est survenue lors de l\'impression. L\'imprimante Zebra est elle paramétrée ?');
          console.log('error zebra sendfile', error);
        })
      }, function(error){
        alert('Une erreur est survenue lors de l\'impression. L\'imprimante Zebra est elle paramétrée ?');
        console.log('error zebra sendfile', error);
      });
Please Register or Login to post a reply

3 Replies

S Steven Si

The Browser Print doesn't provide API to disconnect the Bluetooth connection to the printer. It's up to the Android OS to determine when to disconnect the connection, which is normally after a timeout if there is no traffic on the connection. In your two tablets and one printer scenario, I would recommend to check the printer status first before firing a print from the tablets. If we cannot get the status back from the printer, it would indicate the tablet doesn't have a successful connection to the printer. Only start to print if the tablet has the Bluetooth connection.

J Julien PLESNIAK

Thanks for your help

 

I tried in c# but the official ZEBRA SDK (Zebra.Printer.SDK) I was able to do a very simple test: connection, printing and disconnection.

With it I have exactly the same problem, printing only works on the first printer.

// opening the connection to the bluetooth printer

Connection thePrinterConn = null;

thePrinterConn = ConnectionBuilder.Build($"BT:48:A4:93:D7:B6:ED");

thePrinterConn.Open();


//sending the print

string zplData = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";

thePrinterConn.Write(Encoding.UTF8.GetBytes(zplData));

//closing the connection

thePrinterConn.Close(); 

 

do you know if it is possible to completely disconnect the connection after printing? the close() method does not seem to disconnect completely.

S Steven Si

To close a connection, call the thePrinterConn.close(), as you did in code snippet above. This will close the Bluetooth connection. By default, it takes 5 second to close a Bluetooth connection. After the Bluetooth connection is closed, the Bluetooth icon on the printer should go away. Then you should be able to establish a Bluetooth connection from another device. Before the Bluetooth icon on the printer disappears, you cannot create a new Bluetooth connection from the other device.

CONTACT
Can’t find what you’re looking for?