QZ 1.9 - Issue with RAW Printing

299 views
Skip to first unread message

Antonio Bortolin

unread,
Sep 6, 2016, 6:24:57 AM9/6/16
to qz-print
Hi there,

I need some help!
I need to print receipt with an ECR directly from a php ERP.

Connection parameters are ok, and if I insert my javascript code normally everything is working fine, like this:

function printToHost() {
    if (isLoaded()) {
        
        qz.findPrinter();

        
        window['qzDoneFinding'] = function() {
            
            
            qz.append('3/S/NOME//1/11.11/1/22/'); // Product row 1
            qz.printToHost("192.168.0.240", 9101);
            qz.append('3/S/NOME//1/11.11/1/22/'); // Product row 2
            qz.printToHost("192.168.0.240", 9101);
            qz.append('4/10///0/1/0/');  // Discount on total
            qz.printToHost("192.168.0.240", 9101);
            qz.append('5/1/0////');  // Confirmation - Fiscal Registration
            qz.printToHost("192.168.0.240", 9101);

            
            window['qzDoneFinding'] = null;
        };
    }
}

But obviously, I need to insert the code dynamically, and product rows have to be "echoed" with a php function.

What I'm doing is this:

function printReceipt() {
    if (isLoaded()) {
        // Any printer is ok since we are writing to a host address instead
        qz.findPrinter();

       
        window['qzDoneFinding'] = function() {
           
            <?php
            $rows = pdo_select_query("*", "receipt_rows", "id_receipt = ".$_POST['id']);
            while ($row = pdo_post_rows($rows)) {
                echo 'qz.append("3/S/'.$row['name'].'//'.$row['qty'].'/'.$row['price'].'/'.$row['stat_category'].'//");
                '; // product row
                echo 'qz.printToHost("192.168.0.240", 9101);
                ';
            }
            if($_POST['disc'] > 0) { // if has discount
                echo 'qz.append("4/'.$_POST['disc'].'///0/1/0/"); // Discount on total
                ';
                echo 'qz.printToHost("192.168.0.240", 9101);
                ';
            }
            ?>
            qz.append("5/1/0////");  // Confirmation - Fiscal Registration
            qz.printToHost("192.168.0.240", 9101);

                          window['qzDoneFinding'] = null;
        };
    }
}

With browser inspector, the inserted code looks identical as the first one, but is not working at all.

I'm getting this errors in console:

- Cannot read property 'close' of null
- Cannot read property 'apply' of null

Any help will be great! :)

P.S. I know that repeat append and print more times is not the right way, but with this sh...printer looks like it's the only way.
If I use qz.append(data) is not working.
It's also not working even if I use qz.append("the command"); more times.

Tres Finocchiaro

unread,
Sep 6, 2016, 8:48:55 AM9/6/16
to Antonio Bortolin, qz-print
Antonio,

1.9 is limited when it comes to multiple prints.

For starters, is there a reason why you print in-between each raw command?  That will simplify your usage.

Second, we would suggest migrating your code to 2.0 (a new API) which works much better with queued events.

But for now can you try this:

qz.append('3/S/NOME//1/11.11/1/22/'); // Product row 1
qz.append('3/S/NOME//1/11.11/1/22/'); // Product row 2
qz.append('4/10///0/1/0/');  // Discount on total
qz.append('5/1/0////');  // Confirmation - Fiscal Registration
qz.printToHost("192.168.0.240", 9101);

Long-term we also recommend fetching this data using AJAX as to now write out JavaScript each time.

-Tres

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antonio Bortolin

unread,
Sep 6, 2016, 8:55:54 AM9/6/16
to qz-print, bortolin...@gmail.com
I know, I already use your plugin with 2 different label printers, and it always worked fine. The problem is this printer, if I append before and then print, it doesn't execute any command. Also tried with \r\n, \n and \r. Nothing!

This is driving me crazy! :)

I'm trying something with QZ 2 right now, but I'm not really sure of what I'm doing! I'm a web developer, but my experience in such peculiar functions is limited with the 2 label printers I spoke above!

Where can I find some examples of an AJAX call for this?

Thanks for your answer! 
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.

Tres Finocchiaro

unread,
Sep 6, 2016, 9:47:51 AM9/6/16
to Antonio Bortolin, qz-print
Well, one easy way to spool between each job is to put the "\r\n" back in and use:

  qz.setEndOfDocument("\r\n");
  qz.setDocumentsPerSpool("1");

This will automatically spool between each "\r\n".


Where can I find some examples of an AJAX call for this?

We don't have any ready but the general syntax (assumes jQuery):

 $.ajax("path/to/some/php/echo/function.php", {
      success: function(data) {
         // handle the data
      },
      error: function() {
         // display an error
      }
   });
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.

Antonio Bortolin

unread,
Sep 6, 2016, 10:58:52 AM9/6/16
to qz-print
I tried with AJAX now, but the result remains the same: 

if I compile the code manually, everything works, if I compile it dynamically, the printer doesn't execute any command.
I also tried setEndOfDocument and setDocumentsPerSpool as you said...nothing!

Tres Finocchiaro

unread,
Sep 6, 2016, 11:08:22 AM9/6/16
to Antonio Bortolin, qz-print
Well, if you're ok jumping into 2.0, it has much easier syntax for subsequent prints using ES6 Promises.


The basic syntax is:

foo().then(bar);

As opposed to 1.9 which uses:

foo(); 
 
function fooDone() {
  bar();
}

This will change the dependencies around a bit though.

Furthermore if you feel like you would benefit from official support (even on consignment) please reach-out to the commercial support channel.  We can usually get things setup in about an hour.


Antonio Bortolin

unread,
Sep 6, 2016, 11:14:06 AM9/6/16
to qz-print
I saw that v2 looks pretty easier, the problem is that I don't understand how to connect to host as I always did with 1.9.
So, how should I connect to the printer with IP as the old version? (qz.printToHost("192.168.0.240", 9101);)

Thank you for the time you're spending!

Il giorno martedì 6 settembre 2016 12:24:57 UTC+2, Antonio Bortolin ha scritto:

Tres Finocchiaro

unread,
Sep 6, 2016, 11:32:35 AM9/6/16
to Antonio Bortolin, qz-print

On Sep 6, 2016 11:14 AM, "Antonio Bortolin" <bortolin...@gmail.com> wrote:
>
> I saw that v2 looks pretty easier, the problem is that I don't understand how to connect to host as I always did with 1.9.
> So, how should I connect to the printer with IP as the old version? (qz.printToHost("192.168.0.240", 9101);)
>

https://qz.io/wiki/2.0-Raw-Printing#url

Antonio Bortolin

unread,
Sep 6, 2016, 11:36:42 AM9/6/16
to qz-print
I tried like this, modifying printEPL function on sample.html.
The printer is installed as a generic RAW printer on computer. Obviously updated to v2.

This is my new code:

function printEPL() {
        var config = qz.configs.create();
        var data = [{ type: 'raw', data: null, }];

        data.data = '3/S/DRESS BAG//1/38.50/3//';                    ////// First raw item
        config.setPrinter('ECR');                ////// First printer
        qz.print(config, data)

        .then(function() {
           data.data = '3/S/TROLLEY//1/88.50/3//';                 ////// Second raw item
           config.setPrinter('ECR');            ////// First printer
           return qz.print(config, data);
        })

        .then(function() {
           data.data = '5/1/0////';                 ////// Third raw item
           config.setPrinter('ECR');             ////// Third printer
           return qz.print(config, data);
        })

        .catch(function(e) {
           console.error(e);                // Exceptions throw all the way up the stack
        });
    }

 I'm not getting errors in console, but the printer isn't printing...

Tres Finocchiaro

unread,
Sep 6, 2016, 11:41:30 AM9/6/16
to Antonio Bortolin, qz-print
Looks fine here.  Is there a chance the printer isn't configured for raw printing?  This would explain the need for printing to the IP address in previous examples.

Of course, using the host/url directly would do the trick as well.

-Tres

--

Antonio Bortolin

unread,
Sep 6, 2016, 11:45:53 AM9/6/16
to qz-print, bortolin...@gmail.com
No, i followed your guide and installed it in the right way in Windows and OS X, just to test.
I tried something else, following your last link:

function printEPL() {
        var config = qz.configs.create({ host: "192.168.0.240", port: 9101 }); // or http://<cups-server>/printers/<my-printer>

       var data = [
          '3/S/DRESS BAG//1/38.50/3//',
          '3/S/TROLLEY//1/88.50/3//',
          '5/1/0////'
       ];

       qz.print(config, data).catch(function(e) { console.error(e); });
    
    }

It works, but just in part. The printer executes only the first command. Also tried with \n on the end of every command.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.

Tres Finocchiaro

unread,
Sep 6, 2016, 11:51:29 AM9/6/16
to Antonio Bortolin, qz-print
If that works, can you please try (this is the same technique proposed earlier, force a separate spooled job in between each line, avoiding unnecessary .then() logic.

var config = qz.configs.create({ host: "192.168.0.240", port: 9101, endOfDoc : '\n');

var data = [
   '3/S/DRESS BAG//1/38.50/3//\n',
   '3/S/TROLLEY//1/88.50/3//\n',
   '5/1/0////\n'
];

qz.print(config, data).catch(function(e) { console.error(e); });

To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.

Tres Finocchiaro

unread,
Sep 6, 2016, 11:57:33 AM9/6/16
to Antonio Bortolin, qz-print
Can you please offer some information about the hardware as well so that we can understand what equipment has such limitations (or if perhaps there is a raw command we can borrow from the programmer's guide to avoid the multiple spooled jobs).

-Tres  

Antonio Bortolin

unread,
Sep 6, 2016, 12:07:22 PM9/6/16
to qz-print, bortolin...@gmail.com
Tried to add endOfDoc and \n as you said and guess what? Nothing! :(

This way works everything, but if I echo it with php is the same as with 1.9:

function printEPL() {
        var config = qz.configs.create({ host: "192.168.0.240", port: 9101 }); // or http://<cups-server>/printers/<my-printer>

       var data = [
          '3/S/DRESS BAG//1/38.50/3//'
       ];

       qz.print(config, data).catch(function(e) { console.error(e); });
        var data1 = [
          '3/S/TRROLLEY//1/88.50/3//'
       ];

       qz.print(config, data1).catch(function(e) { console.error(e); });
        var data2 = [
          '5/1/0////'
       ];

       qz.print(config, data2).catch(function(e) { console.error(e); });
    
    }

The printer is a Micrelec Hydra, rebadged version of other similar printers, as the AXON SKY.
I'll send you privately the documentation.

Tres Finocchiaro

unread,
Sep 6, 2016, 12:23:49 PM9/6/16
to Antonio Bortolin, qz-print
Code looks ok, but you should use .then() syntax to ensure the data arrives in the correct order.

Note, this code hasn't been tested for syntax issues.

function printStuff() {
   
var config = qz.configs.create({ host: "192.168.0.240", port: 9101
 });

   
var data = ['3/S/DRESS BAG//1/38.50/3//'
];
   var data1 = ['3/S/TRROLLEY//1/88.50/3//'];
   var data2 = ['5/1/0////'];

   qz.print(config, data).then(function() {
      return qz.print(config, data1);
   }).then(function() {
      return qz.print(config, data2);
   }).catch(function(e) { console.error(e); });
}

Or via $.ajax

function printStuff() {
   
var config = qz.configs.create({ host: "192.168.0.240", port: 9101
 });

   // Fixed data length example.  For dynamic data length, see https://qz.io/wiki/2.0-raw-printing#promise-loop
   var data = [];
   qz.print(config, data).then(function() {
      return $.ajax('/path/to/data.php');
   }).then(function(ajaxData) {
      data = ajaxData;
      return qz.print(config, data[0]);
   }).then(function() {
      return qz.print(config, data[1]);
   }).then(function() {
      return qz.print(config, data[2]);
   }).catch(function(e) { console.error(e); });
}




--

Tres Finocchiaro

unread,
Sep 6, 2016, 12:34:51 PM9/6/16
to Antonio Bortolin, qz-print
Thanks for the manual. The manual mentions STX (x02) and ETX (x03) which are generally used in serial communication.

I'm not sure if this will help but perhaps:

var data = [
   '\x02' + '3/S/DRESS BAG//1/38.50/3//' + '\x03',
   '\x02' + '3/S/TRROLLEY//1/88.50/3//' + '\x03',
   '\x02' + '5/1/0////' + '\x03'
];

Antonio Bortolin

unread,
Sep 7, 2016, 4:55:16 AM9/7/16
to qz-print, bortolin...@gmail.com
Well, I tried your solutions, but nothing works. \x02 and \x03 don't work even if I compile the code statically.

Then I tried to do something different, but I don't know if it's correct (anyway, doesn't work!).

Jquery: (also compiled without \x02 and \x03, same result)

function printEPL() {
   
        var config = qz.configs.create({ host: "192.168.0.240", port: 9101
         });

           // Fixed data length example.  For dynamic data length, see https://qz.io/wiki/2.0-raw-printing#promise-loop
           
        $.ajax("rows.php", {
          success: function(data) {
              result = $.parseJSON(data);
             $.each(result, function() {
                  $.each(this, function(k, v) {
                      console.log('Valore k' + k + ', Valore ' + v);
                      qz.print(config, '\x02' + v[k] + '\x03');
                  });
                });
          },
          error: function() {
             // display an error
          }
       });
    }

rows.php:

<?php
$i = 0;
$data = array();
$rows = pdo_select_query("*", "gaz_receipt_row", "id_receipt = 0");
foreach ($rows as $row) {
    $data[$i] = '3/S/'.$row['name'].'//'.$row['qty'].'/'.$row['price'].'/'.$row['stat_category'].'/'.$row['vat'].'/ ';
    $i++;
}
echo json_encode(array("data" => $data), JSON_UNESCAPED_SLASHES);
?>

Result on console log:

Valore k 0, Valore 3/S/JELLY ANAL SLIM JIM VIBRATOR PINK//1.000/24.00000/1/0.0/ 
Valore k 1, Valore 3/S/Julians Stud Ring//1.000/15.90000/1/22.0/ 

It seems to be correct to me, but nothing works with this printer...

Antonio Bortolin

unread,
Sep 7, 2016, 5:11:37 AM9/7/16
to qz-print, bortolin...@gmail.com
Well, I tried your solutions, but nothing works. \x02 and \x03 don't work even if I compile the code statically.

Then I tried to do something different, but I don't know if it's correct (anyway, doesn't work!).

Jquery: (also compiled without \x02 and \x03, same result)

function printEPL() {
 
        var config = qz.configs.create({ host: "192.168.0.240", port: 9101});

         
        $.ajax("rows.php", {
         success: function(data) {
             result = $.parseJSON(data);
            $.each(result, function() {
                 $.each(this, function(k, v) {
                     console.log('Valore k' + k + ', Valore ' + v);
                     qz.print(config, '\x02' + v[k] + '\x03');
                 });
               });
         },
         error: function() {
        }
       });
   }


Antonio Bortolin

unread,
Sep 7, 2016, 5:12:37 AM9/7/16
to qz-print, bortolin...@gmail.com
rows.php:

<?php
$i = 0;
$data = array();
$rows = pdo_select_query("*", "receipt_row", "id_receipt = 0");
foreach ($rows as $row) {
    $data[$i] = '3/S/'.$row['name'].'//'.$row['qty'].'/'.$row['price'].'/'.$row['stat_category'].'/'.$row['vat'].'/ ';
    $i++;
}
$data[$i] = '5/1/0////';
echo json_encode(array("data" => $data), JSON_UNESCAPED_SLASHES);
?>

Result on console log:

Valore k 0, Valore 3/S/Product 1//1.000/24.00000/1/0.0/ 
Valore k 1, Valore 3/S/Product 2//1.000/15.90000/1/22.0/ 

Tres Finocchiaro

unread,
Sep 7, 2016, 9:22:32 AM9/7/16
to Antonio Bortolin, qz-print
If you want to use AJAX and the promise loop together, you'll need to combine techniques.  Can you confirm that this works works when hard-coded?

If so, I would recommend taking the code one step at a time (first, introduce a single line from AJAX, next, rewrite it all into a Promise Loop).


function printStuff() {
   var config = qz.configs.create({ host: "192.168.0.240", port: 9101 });

   var data = ['3/S/DRESS BAG//1/38.50/3//'];
   var data1 = ['3/S/TRROLLEY//1/88.50/3//'];
   var data2 = ['5/1/0////'];

   qz.print(config, data).then(function() {
      return qz.print(config, data1);
   }).then(function() {
      return qz.print(config, data2);
   }).catch(function(e) { console.error(e); });
}
--

Antonio Bortolin

unread,
Sep 7, 2016, 9:37:34 AM9/7/16
to qz-print, bortolin...@gmail.com
Yes, this is working fine. Even if is not the best solution, I've tried this:

function printEPL() {

    var config = qz.configs.create({ host: "192.168.0.240", port: 9101});
    var data = ['o/Buongiorno!'];
    <?php
    $rows = pdo_select_query("*", "receipt_row", "id_receipt = 0","id ASC");
    while ($row = pdo_post_rows($rows)) {
        echo 'var data'.$row['id'].' = [\'3/S/'.$row['name'].'//'.$row['qty'].'/'.$row['price'].'/'.$row['stat_category'].'/'.$row['vat'].'/\'];
        ';
    }
    echo 'var discount = [\'4/10//PROMOZIONE/0/0/0/\'];
        ';
    echo 'var confirm = [\'5/1/0////\'];
        ';
    ?>
    <?php
    echo 'qz.print(config, data).then(function() {
              return qz.print(config, data);
            })';
    $rows2 = pdo_select_query("*", "receipt_row", "id_receipt = 0","id ASC");
    while ($row2 = pdo_post_rows($rows2)) {
        echo '.then(function() { return qz.print(config, data'.$row2['id'].'); })';
    }
    echo '.then(function() { return qz.print(config, discount); })';
    echo '.then(function() { return qz.print(config, confirm); })';
    echo '.catch(function(e) { console.error(e); });';
    ?>
}

I've compiled it with php, but it's always the same code (except for a couple of commands I've added), and...it doesn't work! I can't explain why.
This is the result code on inspector:

function printEPL() { var config = qz.configs.create({ host: "192.168.0.240", port: 9101}); var data = ['o/Buongiorno!']; var data11 = ['3/S/Prod 1//1.000/24.00000/1/0.0/']; var data135 = ['3/S/Prod 2//1.000/15.90000/1/22.0/']; var discount = ['4/10//PROMOZIONE/0/0/0/']; var confirm = ['5/1/0////']; qz.print(config, data).then(function() { return qz.print(config, data); }).then(function() { return qz.print(config, data11); }).then(function() { return qz.print(config, data135); }).then(function() { return qz.print(config, discount); }).then(function() { return qz.print(config, confirm); }).catch(function(e) { console.error(e); });

I can't see any difference...

Tres Finocchiaro

unread,
Sep 7, 2016, 9:47:52 AM9/7/16
to Antonio Bortolin, qz-print
Looks OK here too although the command o/Buongiorno!" appears to be quite differently formatted from the rest.

I assume uppercase and lowercase commands are supported as well?

Is there anything in the console of the web browser?  If you launch QZ Tray in debug, do you see your commands come across?

When you are coding these statically, is it through sample.html?  Is there a chance we're missing a step (such as qz.websocket.connect) in PHP?

-Tres

--

Antonio Bortolin

unread,
Sep 7, 2016, 9:59:56 AM9/7/16
to qz-print, bortolin...@gmail.com
Yes, upper/lowercase are supported, here's an example from docs: 
"o/TEST MESSAGE" (checksum)

I use this message before products just to launch qz.print(config, data) and then, with while, I echo '.then(function() { return qz.print(config, discount); })';
for every row.

Nothing in console, except for "Established connection with QZ Tray on wss://localhost:8181".

In debugging mode, I get this:

[DEBUG] 2016-09-07 15:55:59,760 @ qz.ws.PrintSocketClient:?


        Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["o/Buongiorno!"]},"timestamp":1473256559759,"uid":"dlzhyf"}


[WARN] 2016-09-07 15:55:59,761 @ qz.ws.PrintSocketClient:?


        Bad signature on request


[INFO] 2016-09-07 15:56:00,609 @ qz.common.TrayManager:?


        Allowed localhost to print to 192.168.0.240


[TRACE] 2016-09-07 15:56:00,609 @ qz.utils.PrintingUtilities:?


        Waiting for processor, 0/3 already in use


[DEBUG] 2016-09-07 15:56:00,609 @ qz.utils.PrintingUtilities:?


        Using qz.printer.action.PrintRaw to print


[DEBUG] 2016-09-07 15:56:00,609 @ qz.printer.action.PrintRaw:?


        Printing to host 192.168.0.240:9101


[INFO] 2016-09-07 15:56:00,612 @ qz.utils.PrintingUtilities:?


        Printing complete


[TRACE] 2016-09-07 15:56:00,612 @ qz.utils.PrintingUtilities:?


        Returning processor back to pool


[DEBUG] 2016-09-07 15:56:00,614 @ qz.ws.PrintSocketClient:?


        Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["3/S/JELLY ANAL SLIM JIM VIBRATOR PINK//1.000/24.00000/1/0.0/"]},"timestamp":1473256560613,"uid":"gkz4xi"}


[WARN] 2016-09-07 15:56:00,614 @ qz.ws.PrintSocketClient:?


        Bad signature on request


[INFO] 2016-09-07 15:56:00,822 @ qz.common.TrayManager:?


        Allowed localhost to print to 192.168.0.240


[TRACE] 2016-09-07 15:56:00,822 @ qz.utils.PrintingUtilities:?


        Waiting for processor, 0/3 already in use


[DEBUG] 2016-09-07 15:56:00,822 @ qz.utils.PrintingUtilities:?


        Using qz.printer.action.PrintRaw to print


[DEBUG] 2016-09-07 15:56:00,822 @ qz.printer.action.PrintRaw:?


        Printing to host 192.168.0.240:9101


[INFO] 2016-09-07 15:56:00,914 @ qz.utils.PrintingUtilities:?


        Printing complete


[TRACE] 2016-09-07 15:56:00,915 @ qz.utils.PrintingUtilities:?


        Returning processor back to pool


[DEBUG] 2016-09-07 15:56:00,916 @ qz.ws.PrintSocketClient:?


        Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["3/S/Julians Stud Ring//1.000/15.90000/1/22.0/"]},"timestamp":1473256560915,"uid":"69vqkd"}


[WARN] 2016-09-07 15:56:00,917 @ qz.ws.PrintSocketClient:?


        Bad signature on request


[INFO] 2016-09-07 15:56:01,388 @ qz.common.TrayManager:?


        Allowed localhost to print to 192.168.0.240


[TRACE] 2016-09-07 15:56:01,389 @ qz.utils.PrintingUtilities:?


        Waiting for processor, 0/3 already in use


[DEBUG] 2016-09-07 15:56:01,389 @ qz.utils.PrintingUtilities:?


        Using qz.printer.action.PrintRaw to print


[DEBUG] 2016-09-07 15:56:01,389 @ qz.printer.action.PrintRaw:?


        Printing to host 192.168.0.240:9101


[INFO] 2016-09-07 15:56:01,391 @ qz.utils.PrintingUtilities:?


        Printing complete


[TRACE] 2016-09-07 15:56:01,392 @ qz.utils.PrintingUtilities:?


        Returning processor back to pool


[DEBUG] 2016-09-07 15:56:01,395 @ qz.ws.PrintSocketClient:?


        Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["4/10//PROMOZIONE/0/0/0/"]},"timestamp":1473256561392,"uid":"6aabvg"}


[WARN] 2016-09-07 15:56:01,396 @ qz.ws.PrintSocketClient:?


        Bad signature on request


[INFO] 2016-09-07 15:56:01,722 @ qz.common.TrayManager:?


        Allowed localhost to print to 192.168.0.240


[TRACE] 2016-09-07 15:56:01,722 @ qz.utils.PrintingUtilities:?


        Waiting for processor, 0/3 already in use


[DEBUG] 2016-09-07 15:56:01,723 @ qz.utils.PrintingUtilities:?


        Using qz.printer.action.PrintRaw to print


[DEBUG] 2016-09-07 15:56:01,723 @ qz.printer.action.PrintRaw:?


        Printing to host 192.168.0.240:9101


[INFO] 2016-09-07 15:56:01,725 @ qz.utils.PrintingUtilities:?


        Printing complete


[TRACE] 2016-09-07 15:56:01,725 @ qz.utils.PrintingUtilities:?


        Returning processor back to pool


[DEBUG] 2016-09-07 15:56:01,727 @ qz.ws.PrintSocketClient:?


        Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["5/1/0////"]},"timestamp":1473256561726,"uid":"gtxieu"}


[WARN] 2016-09-07 15:56:01,727 @ qz.ws.PrintSocketClient:?


        Bad signature on request


[INFO] 2016-09-07 15:56:02,138 @ qz.common.TrayManager:?


        Allowed localhost to print to 192.168.0.240


[TRACE] 2016-09-07 15:56:02,139 @ qz.utils.PrintingUtilities:?


        Waiting for processor, 0/3 already in use


[DEBUG] 2016-09-07 15:56:02,139 @ qz.utils.PrintingUtilities:?


        Using qz.printer.action.PrintRaw to print


[DEBUG] 2016-09-07 15:56:02,139 @ qz.printer.action.PrintRaw:?


        Printing to host 192.168.0.240:9101


[INFO] 2016-09-07 15:56:02,142 @ qz.utils.PrintingUtilities:?


        Printing complete


[TRACE] 2016-09-07 15:56:02,142 @ qz.utils.PrintingUtilities:?


        Returning processor back to pool



QZ is asking authorization for every command and looks like it's working correctly. It does exactly the same as compiling the javascript directly. But the printer does nothing.

I'm running the code with sample.php on web server. It's the same file of your demo with php extension, just to run the query.

Antonio Bortolin

unread,
Sep 7, 2016, 10:10:46 AM9/7/16
to qz-print, bortolin...@gmail.com
Tried again, appending the same php-generated code after ajax call, on an empty div.

This is what I've got on terminal:

[DEBUG] 2016-09-07 16:08:08,250 @ qz.ws.PrintSocketClient:?

Received new certificate from connection through 54096

[INFO] 2016-09-07 16:08:08,250 @ qz.common.TrayManager:?

Allowed localhost to connect to QZ

[DEBUG] 2016-09-07 16:08:08,257 @ qz.ws.PrintSocketClient:?

Message: {"call":"getVersion","promise":{},"timestamp":1473257288254,"uid":"9tnsya"}

[WARN] 2016-09-07 16:08:08,258 @ qz.ws.PrintSocketClient:?

Bad signature on request

[DEBUG] 2016-09-07 16:08:10,850 @ qz.ws.PrintSocketClient:?

Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["o/Buongiorno!"]},"timestamp":1473257290848,"uid":"ljv5bl"}

[WARN] 2016-09-07 16:08:10,850 @ qz.ws.PrintSocketClient:?

Bad signature on request

[INFO] 2016-09-07 16:08:11,866 @ qz.common.TrayManager:?

Allowed localhost to print to 192.168.0.240

[TRACE] 2016-09-07 16:08:11,866 @ qz.utils.PrintingUtilities:?

Waiting for processor, 0/3 already in use

[DEBUG] 2016-09-07 16:08:11,866 @ qz.utils.PrintingUtilities:?

Using qz.printer.action.PrintRaw to print

[DEBUG] 2016-09-07 16:08:11,867 @ qz.printer.action.PrintRaw:?

Printing to host 192.168.0.240:9101

[INFO] 2016-09-07 16:08:11,960 @ qz.utils.PrintingUtilities:?

Printing complete

[TRACE] 2016-09-07 16:08:11,988 @ qz.utils.PrintingUtilities:?

Returning processor back to pool

[DEBUG] 2016-09-07 16:08:11,990 @ qz.ws.PrintSocketClient:?

Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["3/S/JELLY ANAL SLIM JIM VIBRATOR PINK//1.000/24.00000/1/0.0/"]},"timestamp":1473257291989,"uid":"dgku4n"}

[WARN] 2016-09-07 16:08:11,991 @ qz.ws.PrintSocketClient:?

Bad signature on request

[INFO] 2016-09-07 16:08:12,428 @ qz.common.TrayManager:?

Allowed localhost to print to 192.168.0.240

[TRACE] 2016-09-07 16:08:12,428 @ qz.utils.PrintingUtilities:?

Waiting for processor, 0/3 already in use

[DEBUG] 2016-09-07 16:08:12,428 @ qz.utils.PrintingUtilities:?

Using qz.printer.action.PrintRaw to print

[DEBUG] 2016-09-07 16:08:12,429 @ qz.printer.action.PrintRaw:?

Printing to host 192.168.0.240:9101

[INFO] 2016-09-07 16:08:12,431 @ qz.utils.PrintingUtilities:?

Printing complete

[TRACE] 2016-09-07 16:08:12,431 @ qz.utils.PrintingUtilities:?

Returning processor back to pool

[DEBUG] 2016-09-07 16:08:12,432 @ qz.ws.PrintSocketClient:?

Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["3/S/Julians Stud Ring//1.000/15.90000/1/22.0/"]},"timestamp":1473257292431,"uid":"ii448d"}

[WARN] 2016-09-07 16:08:12,433 @ qz.ws.PrintSocketClient:?

Bad signature on request

[INFO] 2016-09-07 16:08:12,957 @ qz.common.TrayManager:?

Allowed localhost to print to 192.168.0.240

[TRACE] 2016-09-07 16:08:12,957 @ qz.utils.PrintingUtilities:?

Waiting for processor, 0/3 already in use

[DEBUG] 2016-09-07 16:08:12,957 @ qz.utils.PrintingUtilities:?

Using qz.printer.action.PrintRaw to print

[DEBUG] 2016-09-07 16:08:12,958 @ qz.printer.action.PrintRaw:?

Printing to host 192.168.0.240:9101

[INFO] 2016-09-07 16:08:12,960 @ qz.utils.PrintingUtilities:?

Printing complete

[TRACE] 2016-09-07 16:08:12,960 @ qz.utils.PrintingUtilities:?

Returning processor back to pool

[DEBUG] 2016-09-07 16:08:12,962 @ qz.ws.PrintSocketClient:?

Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["4/10//PROMOZIONE/0/0/0/"]},"timestamp":1473257292960,"uid":"qpjhli"}

[WARN] 2016-09-07 16:08:12,962 @ qz.ws.PrintSocketClient:?

Bad signature on request

[INFO] 2016-09-07 16:08:13,418 @ qz.common.TrayManager:?

Allowed localhost to print to 192.168.0.240

[TRACE] 2016-09-07 16:08:13,419 @ qz.utils.PrintingUtilities:?

Waiting for processor, 0/3 already in use

[DEBUG] 2016-09-07 16:08:13,419 @ qz.utils.PrintingUtilities:?

Using qz.printer.action.PrintRaw to print

[DEBUG] 2016-09-07 16:08:13,419 @ qz.printer.action.PrintRaw:?

Printing to host 192.168.0.240:9101

[INFO] 2016-09-07 16:08:13,422 @ qz.utils.PrintingUtilities:?

Printing complete

[TRACE] 2016-09-07 16:08:13,422 @ qz.utils.PrintingUtilities:?

Returning processor back to pool

[DEBUG] 2016-09-07 16:08:13,423 @ qz.ws.PrintSocketClient:?

Message: {"call":"print","promise":{},"params":{"printer":{"host":"192.168.0.240","port":9101},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":600,"interpolation":"bicubic","jobName":null,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":["5/1/0////"]},"timestamp":1473257293422,"uid":"d7q95x"}

[WARN] 2016-09-07 16:08:13,424 @ qz.ws.PrintSocketClient:?

Bad signature on request

[INFO] 2016-09-07 16:08:13,891 @ qz.common.TrayManager:?

Allowed localhost to print to 192.168.0.240

[TRACE] 2016-09-07 16:08:13,891 @ qz.utils.PrintingUtilities:?

Waiting for processor, 0/3 already in use

[DEBUG] 2016-09-07 16:08:13,891 @ qz.utils.PrintingUtilities:?

Using qz.printer.action.PrintRaw to print

[DEBUG] 2016-09-07 16:08:13,892 @ qz.printer.action.PrintRaw:?

Printing to host 192.168.0.240:9101

[INFO] 2016-09-07 16:08:13,893 @ qz.utils.PrintingUtilities:?

Printing complete

[TRACE] 2016-09-07 16:08:13,893 @ qz.utils.PrintingUtilities:?

Tres Finocchiaro

unread,
Sep 7, 2016, 11:38:56 AM9/7/16
to Antonio Bortolin, qz-print
This log looks fine.  I assume it's still not working.

At this point you may consider seeking premium support so that a technician can do an interactive session with your environment.

Best regards,
--

Antonio Bortolin

unread,
Sep 7, 2016, 11:39:57 AM9/7/16
to qz-print, bortolin...@gmail.com
Ok, thank you Tres for your time! :(

Hope I'll solve with them!
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.

Tres Finocchiaro

unread,
Sep 8, 2016, 12:50:08 PM9/8/16
to Antonio Bortolin, qz-print
3/S/PRODUCT DESCRIPTION NAME HERE//1.000/24.00000/1/0.0/ 

After comparing the examples which printed against the examples that didn't we found the following can break printing on this device:

  1. Item name (PRODUCT DESCRIPTION) must be truncated to fit on receipt
  2. Price (24.00000) needs to be formatted with only two decimal places (24.00)
  3. Tax must be left blank if zero is needed (0.0)
Once we did that, the receipts starting printing again.

Best regards,



To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages