Understanding what favor to use for raw printing data format

4 views
Skip to first unread message

Be the Change

unread,
Apr 2, 2024, 12:24:04 PMApr 2
to qz-print
Hello,

I have a ZPL code with two text fields and a code 128 barcode and I am trying to figure out how to use that in QZ Tray.


where the data is prepared like this:




Since I've the zpl code with me, how should I go about creating data? I was looking at the sample.html and there's a printFile(file) function like the following. But since I have the zpl command with me, what should I use instead of flavor: 'file'? And can I just put al the commands next to data: ?

 function printFile(file) {
        var config = getUpdatedConfig();
        //print options not used with this flavor
     
        var printData = [
            { type: 'raw', format: 'command', flavor: 'file', data: 'assets/' + file }
        ];

        qz.print(config, printData).catch(displayError);
    }

Lite Finocchiaro

unread,
Apr 2, 2024, 12:59:50 PMApr 2
to Be the Change, qz-print
If you're putting the ZPL commands in-line, you can use

flavor: 'plain'


Cheers,

Lite Finocchiaro
VP, QZ Industries

--
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+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/b22febb8-35a5-4974-8f1e-0873938102a0n%40googlegroups.com.

Lite Finocchiaro

unread,
Apr 2, 2024, 1:54:36 PMApr 2
to Be the Change, qz-print
I don't know if I would call the function "printFILE" in this case, but yes. 

You may have to wrap the lines in single quotes with commas and newlines, though (below sample copied and pasted from sample.html):

case 'ZPL':
                printData = [
                    '^XA\n',
                    '^FO50,50^ADN,36,20^FDPRINTED WITH QZ ' + qzVersion + '\n',
                    '^FS\n',
                    '^XZ\n'




On Tue, Apr 2, 2024 at 1:37 PM Be the Change <beth...@gmail.com> wrote:
Thanks. So you mean something like this? I just copied a random zpl code from here (https://gist.github.com/adrianmi8/84733c369f51069af673564bf8749663) for clarification purpose

function printFile(file) {
        var config = getUpdatedConfig();
        //print options not used with this flavor

        var printData = [
            { type: 'raw', format: 'command', flavor: 'plain', data: '
^XA
^LT120
^FX Top section
^CFB,25
^FO50,173^FDFROM:^FS
^FO200,173^FDTest sender^FS
^FO200,228^FD10 MOUNTAIN PKWY^FS
^FO200,283^FDTN, COLLIERVILLE, 38017^FS
^FO50,343^GB706,1,3^FS
^FX Second section with recipient address
^CFB,25
^FO50,363^FDTO:^FS
^FO200,363^FDJohn Smith^FS
^FO200,423^FDAccounts Payable Dept.^FS
^FO200,473^FD123 Market Street^FS
^FO200,523^FDTX, Dallas, 75270^FS
^FO50,4830^GB706,1,3^FS
^FX Third section with shipment numbers
^CFB,25
^FO60,593^FDPO#^FS
^FO230,593^FB542,1,0,N,0^FD0001234^FS
^FO60,623^FDDept.^FS
^FO230,653^FB542,1,0,N,0^FD^FS
^FO60,723^FDStore^FS
^FO230,723^FB542,1,0,N,0^FDMAIN BRANCH^FS
^FO60,823^FDDuns#^FS
^FO230,823^FB542,1,0,N,0^FD123123123^FS
^FO50,873^GB706,1,3^FS
^FX Fourth section with package description
^CFB,25
^FO60,893^FB692,5,4,N,0^FDPRODUCT A x 1, PRODUCT B x 4\&^FS
^FX Fifth section with Box counter
^CFB,25
^FO60,1000^FB692,1,0,C,0^FDBox 1 of 1^FS
^FO60,1000^FB692,1,0,C,0^FD__________^FS
^FO60,1000^FB692,1,0,C,0^FD__________^FS
^XZ' }
        ];

        qz.print(config, printData).catch(displayError);
    }

Lite Finocchiaro

unread,
Apr 2, 2024, 2:38:55 PMApr 2
to Be the Change, qz-print
Thanks for the update!


On Tue, Apr 2, 2024 at 2:14 PM Be the Change <beth...@gmail.com> wrote:
Thanks. I put it in one line as using slash n was creating some issues for soem reason and I will be getting this code from my rest web service so I guess it doesn't matter. It worked.

function printZPLCode() {

        var config = getUpdatedConfig();
        //print options not used with this flavor

        var printData = [
            {
                type: 'raw', format: 'command', flavor: 'plain',

                data:  '^XA^FO50,50^ADN,36,20^FDPRINTED WITH QZ'+qzVersion+'^FS^XZ'


            }
        ];

        qz.print(config, printData).catch(displayError);


    }

Lite Finocchiaro

unread,
Apr 2, 2024, 5:44:41 PMApr 2
to Be the Change, qz-print
I am wondering if it should have worked from my remote computer as well?

Are you saying that it didn't? 

Pixel vs. raw configs to the same printer will vary due to the printer in question, but without taking a remote machine into consideration, the driver will generally differentiate between the two data types on a machine level. 

I think the RDP may add a layer of complexity to that. It's always a good idea to test at https://demo.qz.io to make sure QZ-Tray can "see" the printer you want to use, though. If Java can't see the printer, QZ-Tray can't either.

If I'm misunderstanding something, please let me know.

Cheers,

Lite

On Tue, Apr 2, 2024 at 5:31 PM Be the Change <beth...@gmail.com> wrote:
No problem. One question - is there any difference when it comes to the print command when I'm using ZPL code raw printing vs Pixel Code printing. I mean, whenever I've used pixel printing scenario, I usually RDP into my remote work station and then used the printer on my physical location to print labels that is hooked up with my computer. 

In case of ZPL code, I have only seen this working from my physical computer ( a scenario where the Zebra printer is hooked up directly to my computer). I am wondering if it should have worked from my remote computer as well?

Be the Change

unread,
Apr 2, 2024, 5:45:08 PMApr 2
to Lite Finocchiaro, qz-print
Thanks. I put it in one line as using slash n was creating some issues for soem reason and I will be getting this code from my rest web service so I guess it doesn't matter. It worked.

function printZPLCode() {

        var config = getUpdatedConfig();
        //print options not used with this flavor

        var printData = [
            {
                type: 'raw', format: 'command', flavor: 'plain',

                data:  '^XA^FO50,50^ADN,36,20^FDPRINTED WITH QZ'+qzVersion+'^FS^XZ'


            }
        ];

        qz.print(config, printData).catch(displayError);


    }

Be the Change

unread,
Apr 2, 2024, 5:45:08 PMApr 2
to Lite Finocchiaro, qz-print
Thanks. So you mean something like this? I just copied a random zpl code from here (https://gist.github.com/adrianmi8/84733c369f51069af673564bf8749663) for clarification purpose

function printFile(file) {
        var config = getUpdatedConfig();
        //print options not used with this flavor

        var printData = [

Be the Change

unread,
Apr 2, 2024, 5:45:18 PMApr 2
to Lite Finocchiaro, qz-print
No problem. One question - is there any difference when it comes to the print command when I'm using ZPL code raw printing vs Pixel Code printing. I mean, whenever I've used pixel printing scenario, I usually RDP into my remote work station and then used the printer on my physical location to print labels that is hooked up with my computer. 

In case of ZPL code, I have only seen this working from my physical computer ( a scenario where the Zebra printer is hooked up directly to my computer). I am wondering if it should have worked from my remote computer as well?

Be the Change

unread,
Apr 2, 2024, 5:53:36 PMApr 2
to Lite Finocchiaro, qz-print
Are you saying that it didn't? 

So far the ZPL command testing only worked from a computer to which my ZD421 printer is directly connected to. It hasn't worked from my remote computer yet. 

In case of pixel, it works in both scenarios. Although it takes little bit time when I give a print command from remote computer in case of pixel. 

I double checked and  https://demo.qz.io  can see ZDesigner ZD421-203dpi ZPL (redirected 3) on my remote computer. And it won't print after selecting ZPLII radio button and then clicking zpl_sample.txt button

Whereas, if I do the same thing from my computer where the printer is directly connected to, https://demo.qz.io  can see  ZDesigner ZD421-203dpi ZPLand IT WILL print just fine after selecting ZPLII radio button and then clicking zpl_sample.txt button

Lite Finocchiaro

unread,
Apr 2, 2024, 6:46:12 PMApr 2
to Be the Change, qz-print
Can you see the printer queue the remote computer using https://demo.qz.io ?

You might be successful creating another queue for the same printer, but but a raw protocol rather than the driver:

Be the Change

unread,
Apr 2, 2024, 7:12:01 PMApr 2
to Lite Finocchiaro, qz-print
The print queue seems to be empty in case of printing ZPL code. I checked it at remote and my physical computer as well. I see a window popping up for a fraction of second when I give a print command from remote computer but I can't see what was it for,

image.png


I didn't quite understand your other suggestion of creating another queue for same printer. I mean how it would solve or troubleshoot our issue here.

Thanks!

Tres Finocchiaro

unread,
Apr 3, 2024, 11:42:34 AMApr 3
to Be the Change, Lite Finocchiaro, qz-print
When you share a printer from one Windows machine to another, the other machine usually receives a portion of the printer driver so that it can know which driver features to present to the user at printing time.  Although our experience with the ZDesigner driver has been very good (raw documents are ALWAYS sent to the printer), I can't recall the last time we tried to use the shared printer option with the Zebra driver (we'd normally consider this more of a Windows/Zebra support issue than it is a QZ Tray issue).

I understand that offering a separate raw queue is a degradation in behavior, but this is behavior that is out of our control (driver + OS behavior).

The only option we can recommend (aside from escalating this issue with Zebra or Microsoft) is to use a secondary queue for raw prints.  This will likely require a second shared queue.  We understand this is not ideal.

We are constantly researching ways to influence Winspool to do things that it wasn't intended to do, but we haven't yet mastered the "forceRaw" option like we have with CUPS on Mac and Linux, so I'm sorry that bypassing the driver is not behaving as you'd expect.

If you do figure out a way to get this working, please share, we're always eager to learn.






Reply all
Reply to author
Forward
0 new messages