Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

label printing question: how to print a label in .ZPL format to a Zebra printer with report form ? 1

Status
Not open for further replies.

Steve Yu

Programmer
Nov 6, 2021
88
US
Hello,

No problem with embedding a .PNG image file in a report form that would send the label directly to the the specified printer.
How do you accomplish the same with a .ZPL label ?
Can only find instruction that entails clicking through Zebra printer preference, locating the .ZPL in some folder and print one by one. Not exactly the type of automation we are looking for.
Help appreciated.

environment: VFP 9.0, Windows Server 2019, Widows 10,11 PC.

Steve Yu
 
First of all you have to setup a printer like "ZEBRA ZPL" (name of your choice) following these instructions:

It's creating a (virtual) printer based on a standard Windows printer driver "Generic / Text Only".

Once you have that the essential Foxpro code to print a file is:
Code:
SET PRINTER TO NAME ('name you choose while installing the (virtual) printer')
TYPE ("filename") TO PRINTER

This has has nothing to do with embedding an image into an FRX nor does it work in mixed mode, you either print an FRX or you print a file. The only overlap of these is that you can print an FRX TO a file, but then the file could be a PDF, anything, usually just text not printer commands, so usually one has nothing to do with the other.


Chriss
 
Thanks for the reply, Chris.
Would this work for bar code/QR code labels (vs text only), for example UPS/FedEx shipping labels ?

Steve Yu
 
Steve,

you mistake "Text Only" as having this literal meaning. It's more about "Generic". This printer driver means it forwards anything sent to it 1:1 to a printer at the configured Port (USB/PRT/COM/serial, whatever).
And my educated guess for ZPL is Zebra Printer Language. Which means the files you can print could be text mixed in with binary data. I'd guess (again) some ZPL commands would specify files names to print or creating QR codes of a string or other data, so there's no limitation to only be able to print text.

You should actually be more able to answer your own question, because from your initial post I get you have an assorted list of ZPL files. If you don't know what they are for, then the question I have is why do you even care for printing them.

All todays printers, also Zebra printers also allow to install a "normal" (GDI+) printer specific driver that allows using it with VFP reports. The endless paper rolls or labels and some other specifics require some other options than usual, but I have designed usual FRX reports for such printers that used a configuration option to automatically send a paper cut command after each report, and so you don't require to be able to send Zebra specific commands to a Zebra printer. Think mabout it more generally, any printer has some commnd language specific to it, some by more generally defined standards like Postscript, and printer drivers in general "hide" these languages and command from you and are therefore usable top print anything that Windows provides in the form of GDI+ - which stands for Graphics Device Interface and in short means anything you prepare is a graphic format (both vector for fonts/lines and pixel formats for images) and then the driver has to process that and forward it to the printer.

In essence you can do everything in both ways. If you're not at all familiar with Zebra Printer Language commands I guess you at least would have capabilities in designing VFP reports (FRXes) and then using the usual printer drivers would get you going easier than taking the learning curve and hurdle to learn printer commands that are also only specifically working for Zebra.

As far as I know the community of Fox developers the preferred method is printing directly, this comes from starting in old times where sending files to printers was the usual way, today you have printer drivers with more abilities, allowing you to, for example, use any true type font, design reports with graphics and have more of a visual preview of the printed receipt/label/whatever than with commands. Are you a DOS shell guy? Then sending out commands may be more for you? Are you a Windows user and have you designed VFP reports before? Then don't care about ZPL files and what commands they contain.

Chriss
 
Thanks again, Chris.
Will try the generic text approach.
However we are currently able to print .PNG labels using report form.

Capture_jjsrox.png


The pname holds the name of the .png image file (barcode.png for example) and the form is bound to the Zebra label printer.
Actually the form works fine to print the label in .png format, except the barcode portion on the hardcopy label won't scan (QR code portion scans fine).
So we are trying to use the .zpl format (which is one of two formats we can choose for the API download routine).
There lies the problem: it does not work the same way like .png.
We'll try the generic text method and see if it works with the report form; otherwise we'll try the "type to printer" that you have suggested.

Steve Yu
 
Steve Yu said:
We'll try the generic text method and see if it works with the report form; otherwise we'll try the "type to printer" that you have suggested.

Ther's a misunderstanding again.

If you establish a printer based on the "Generic / Text Only" driver you won't be able to print an FRX to it, you will need to print ZPL files and the way to print a file is to use the TYPE command. It's pretty much like the DOS command to type a text to the DOS screen, it just "types" it to the printer.

Chriss
 
Steve Yu said:
the barcode portion on the hardcopy label won't scan
Are you talking about 2d barcodes (lines)?

Then what matters is high contrast. Look into the printer options of the Zebra printer driver you use for FRX printing to set contrast higher. Also, look at the dpi (dots per inch) resolution of the printer. Generate barcodes with that same resolution so barcode graaphics print with pixel sizes matching the printer resolution.

QR codes can work with less cotrast as they contain error correction codes, 2D barcodes don't have that feature.

Chriss
 
Chris,

I'm having trouble setting up the 'virtual printer'.
In the ports selection I don't see 'USBxxx Virtual port..' at all for the Zebra printer.
Also, all our local and remote Zebra label printers are configured as TCP/IP printers.
I went ahead and set up the generic text driver with link to the TCP/IP port where the printer is bound.
But no success so far to get any hardcopy labels coming out the printer with the 'Type .. to Printer' method.
As to the ZPL file content (resolution, 2D size, etc.), we don't have control at all as it is downloaded via our trading partner's API.
Googling 'USB virtual printer' now.
Any suggestion is welcome.

Steve Yu
 
Well, the image of step 3 from the Zebra article also lists TCP/IP:

rtaImage_sa44vp.png


In a later step you still have to choose that:
rtaImage_ktdk79.png


Even though it allows to add a printer using TCP/IP address, you only get the the choice of the Generic /Text Only driver using this last option.
Then I'd try the create new port option and enter the LAN_... port name you got from looking into the ports in the step above.

Chriss
 
Chris,

Thanks again.
It is WORKING now !
Earlier today we did create the generic text driver with link to the TCP/IP port of the desired printer.
But the 'Type ... to printer' command failed (nothing sent to the print queue or printer).
We have now figured out the problem as we have been continuing the trouble shoot steps: we mis-labeled the printer name with wrong server prefix.
Much appreciated the help always.

Steve Yu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top