LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance with Printing to Zebra QL220 using the LabVIEW report VI

I currently am trying to use the LabVIEW report VI to output a formatted set of strings to the above mentioned printer.
The UMPC hardware that runs the developed application is bare bones XP box and doesn't' have MS office installed
I use the LV new report set to a standard report and  successfully set orientation to portrait or Landscape, set margins and set report fonts and headers.. However  in sending the text strings to this label printer (labels are 45mm X 60mm) I find that that two issues arise.
1. Printing out double labels. The pagination fails and prints a blank label after each print when text is output.  However if I disable all headers and body text (i.e blank label print). This pagination works fine.?
2. The formatting of the information on the page reliably, I currently use inserted blank spaces, is there a better way?
 
I thought, perhaps I should try using the ZLP programming language, but then not sure how to I send it to a USB printer? Has any one had any experience with this and these label printers ?  
Thanks
Greg Nicholls
0 Kudos
Message 1 of 10
(5,020 Views)

Yes, I have had expereince with these printers. Though I am more familiar with Zebra's desktop and tabletop printers. You should be able to define a label in either the CPCL or ZPL language fairly easily. If you could post an exampl eof what you want your label to look like I could provide some assistance.

 

As for writing to the printer using USB I believe you have a few options. One would be to add a print driver and specify the printer as a raw printer. Then you would print through that driver. The other option would be to use a custom VISA USB driver. You can use the driver wizard to create the driver. This would be the easiest option. The QL220 has a VID of 0x0A5F and a PID of 0x003B. Communicating through USB to this printer via VISA is pretty straightforward. You basically need the VISA Open, Read (if necessary), Write and Close.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 10
(5,016 Views)

Mark, Any guidance would be appreciated.- i assume you are talking about the instrument wizzard?

All I am trying to achieve is a simple label of the following layout Where the filed are grabbed out of the labview program (which all seams to work fine) as shown below

 

Title (bold)

Date DD:MM YYYY HH:MM - this is from the lavview application not the printer generated time date stamp

Operator : (initials)

Organization:(name)

Location:(name)

Reason:(field value)

Post Comment: (field Value)

S/N :(list of 4 serial numbers one beneath the other)

D/F: (calculated labview field)

blank line

SIgnature_________________

 

It is a calibration report that reads an instrument & get the parameters and prints the above label.

 

I have tried three alternative using the Labview , including the report vi , sending as a cluster of strings as an image, sending formatted serial text, and attempted the send using Active x.

It messes with the pagination and I wonder if it is because I am using the windows driver and spooler? ( this is a local USB printer) if I reduce the label size to to a value 45X58mm and print text to the label it prints the data to the single label but stops short and wont spool to the next gap (am using the gap sensing). Simply adding a line feed to the end of the formatted text results in a blank label being printed after the populated label.

 

Also if I set the number of copies to two this also fails with the labview report vi.

 

I have played with setting in the print driver and within the labview environment and simply getting a nice formatted label which spools  correctly to the next label hasn't been achieved.

 

Any guidance would be gratefully appreciated.

 

Greg Nicholls

0 Kudos
Message 3 of 10
(5,001 Views)

Try using the following label format in your application:

 

! 0 200 200 440 1
TEXT 4 0 20 10 <TITLE>
TEXT 0 3 10 70 <TIMESTAMP>
TEXT 0 3 10 100 Operator: <INITIALS>
TEXT 0 3 10 130 Organization: <ORGANIZATION>
TEXT 0 3 10 160 Location: <LOCATION>
TEXT 0 3 10 190 Reason: <REASON>
TEXT 0 3 10 220 Post Comment: <COMMENT>
TEXT 0 3 10 250 S/N: <SN>
TEXT 0 3 10 280 D/F: <DATEFIELD>
TEXT 0 3 10 340 Signature:
LINE 165 365 380 365 1
PRINT

 

Replace the fields <x> with the appropriate data using calls to Replace String. Configure your print driver to be a raw printer. This should print the desired label you want.

 

NOTE: The above is using CPCL commands to format and print the label. This is the native print language for the QL220.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 10
(4,991 Views)

Thanks for your input.

I havent been able to successfully accomplish a print with the CPCL protocol via the port. my other concern is that this is nolonger a generic selectable printer using the windows default. (if the operatotrs were to replace with another label printer).

I have attached a code snippett  of what code i am running on my development machine. If i set it too a standard report i get the double label printing occuring where the last label is balnk as though the pagination or gap sense fails. if i set it too word it successfully prints only a single label?????

what is the difference between these two ?

Can i use the free microsoft word viewer as the interface  to LabVIEW reports vi to print a label or does it have to be the complete word office package? i have installed this and i keep getting a "-41106 error code" saying NI_Word.LVclass.new.report subVi......etc. ??? as though some library is not found

Thanks for your assistance

Greg Nicholls

0 Kudos
Message 5 of 10
(4,967 Views)

Greg,

 

I can't comment much on the LV report generation tools as I have not used them often. They don't work as seamlessly with label printers as the report generation tools do not provide access to all the features of the printer. I am not sure why you are seeing double prints.

 

What was the issue you were having with using the CPCL? I understand your concern about providing a generic solution but the CPLC should have worked for you. Were you having issues with the communication or the actual label output from the printer? When using the straight CPCL you should send the data to the printer directly and not send it via the report generation toolkit.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 10
(4,938 Views)

Mark

thaking you for your input i have been  persisting with the CPCL approach but haven't been able to get the USB connectivity to the Zebra printer to work.

I have been following the labview examples and it indicates that i should configure the printer as a raw input device. (which i believe i have done  through the windows printer setting). However the readings suggest that i need to set it up in MAX first -  this is where i think i mabe misunderstanding the process as max dosent seem to be able to see the printer.

Would you be able to assist with an example code snippet  of how to establosh connectivity or provide helpful links 

Thanking you

Greg

0 Kudos
Message 7 of 10
(4,916 Views)

You can use the driver wizrd in Max to create a driver for the printer. The VID is 0x0A5F and the PID for the QL220 is 0x003B. You can get teh device's serial number using the following command: [! U1 getvar "usb.device.serial_string" ]. The device wizard needs teh VID, PID and serial number of the device. It will create a Window's inf file and install this on your system. Once installed you can use the basic VISA commands (Open, Read, Write, Close) to communicate with the printer on the USB port. To build the VISA resource name you can use Format To String with the following format string: "USB::0x%04x::0x%04x::%s::RAW". The first parameter is the VID, the second is the PID and the third is the serial number.

 

The one issue with this approach is that other programs that would require a driver for the printer will not be able to communicate with it. Once a driver is installed that is the only one that can be used. There may be a way to send the raw data through the Windows printer driver but I have never investigated that approach.

 

I use the above approach for all of my USB communcations with Zebra printers.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 10
(4,885 Views)

hi all

 

i am C sharp programer

 

and i have zebra QL 220 plus

 

and roll type is 42X20mm

 

and i have the zebra sdk

 

and i create mobile application in C# smart device

 

and i tring to connect to printer from my application by bluetooth

 

in sdk i got this and use

 

 

using System;
using ZSDK_API.Comm;
using System.Text;
using System.Threading;

// This example prints "This is a ZPL test." near the top of the label.
private void SendZplOverBluetooth(String theBtMacAddress) {
    try {
        // Instantiate a connection for given Bluetooth(R) MAC Address.
        ZebraPrinterConnection thePrinterConn = new BluetoothPrinterConnection(theBtMacAddress);

        // Open the connection - physical connection is established here.
        thePrinterConn.Open();

        // Defines the ZPL data to be sent.
        String zplData = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";

        // Send the data to the printer as a byte array.
        thePrinterConn.Write(Encoding.Default.GetBytes(zplData));

        // Make sure the data got to the printer before closing the connection
        Thread.Sleep(500);

        // Close the connection to release resources.
        thePrinterConn.Close();

    } catch (Exception e) {

        // Handle communications error here.
        Console.Write(e.StackTrace);
    }
}

// This example prints "This is a CPCL test." near the top of the label.
private void SendCpclOverBluetooth(String theBtMacAddress) {
    try {
        // Instantiate a connection for given Bluetooth(R) MAC Address.
        ZebraPrinterConnection thePrinterConn = new BluetoothPrinterConnection(theBtMacAddress);

        // Open the connection - physical connection is established here.
        thePrinterConn.Open();

           // Defines the CPCL data to be sent.
        String cpclData = "! 0 200 200 210 1\r\n"
                        + "TEXT 4 0 30 40 This is a CPCL test.\r\n"
                        + "FORM\r\n"
                        + "PRINT\r\n";

        // Send the data to the printer as a byte array.
        thePrinterConn.Write(Encoding.Default.GetBytes(cpclData));

        // Make sure the data got to the printer before closing the connection
        Thread.Sleep(500);

        // Close the connection to release resources.
        thePrinterConn.Close();

    } catch (Exception e) {

        // Handle communications error here.
        Console.Write(e.StackTrace);
    }
}

 and once i use ZPL method it print 17 barcod always with 16 blank Patches (labels)

 

and  when i use CPCL method it print 12 BarCode always with 11 blank Patches (labels)

 

and i dont know why ?

 

it must print 1 Patch (label)

 

what i can do  and i dont think there is eny rong with my code

 

all waht i want is how i can give Length and width and how much label print coz it is always print 17 or 12 what i can do ?

 

0 Kudos
Message 9 of 10
(4,680 Views)

Hey mohm4z, 

 

Thanks for posting on our forums. I'm looking through your post and I'm trying to figure out if you're using any National Instruments(NI) hardware or software. The original post was related to interfacing the Zebra QL220 with a LabVIEW Report VI. In your case though I am not seeing where you're using any of our products. Your coding all seems to relate to functions and libraries for non-NI devices. With that being said it will be difficult for me to provide thorough advice because I'm not extremely familiar with this hardware. Hopefully someone else who is familiar with your application will be able to comment on your issue.

Tim A.
0 Kudos
Message 10 of 10
(4,654 Views)