314
Views
3
Comments
Directly printing to network printer without dialog box
Question

I am currently building a prototype that should allow to print a label on a network printer (Zebra) without any dialog box in between (no window.print). I found following JavaScript code but nothing is printed... I am using the Personal Environment. What am I doing wrong? (the x.x.x.x should of course be replaced with a proper IP address).


SyntaxEditor Code Snippet

var URL = 'http://x.x.x.x/pstprint';
var async = true;
var method = 'POST';
var ZPL = '^XA^FO20,10^AD^FDOutSystems Test^FS^FO20,60^B3^FD" + GetProductionOrder.List.Current.Material.Number + "^FS^XZ';
var request = new XMLHttpRequest();

request.onload = function()
{
    var status = request.status;
    var data = request.reponseText;
}

request.open(method, URL, async);
request.send(ZPL);
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Eric,

Unless your browser is in kiosk mode, you cannot do this for security reasons (you wouldn't want any web page to be able to send data to or otherwise access your printer).

UserImage.jpg
Eric Kuijper

Hi Kilian,

Would it be possible at all to connect to a network printer when running OutSystems (Personal Environment) in Chrome Kiosk Mode?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Afaik (but google for more info), if running in kiosk mode, there's no dialog popping up when using document.print().

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.