Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
2
Erster Beitrag:
vor 8 Jahren, 1 Monat
Letzter Beitrag:
vor 8 Jahren, 1 Monat
Beteiligte Autoren:
DarrenF

[WD12] Printing to a Zebra label printer

Startbeitrag von DarrenF am 29.07.2009 13:08

Hi guys,

Does anyone have an example of writing directly to a Zebra label printer using the Zebra internal language?

I need to write something like the following:



N
A230,5,0,3,2,2,N,"XYZ Cycle Shop"
A230,45,0,3,1,1,N,"Shimano"
A480,45,0,3,1,1,N,"9999.99"
A230,65,0,3,1,1,N,"XT 32 Hole Hubs"
B245,90,0,E30,3,5,70,B,"123456789012"
A250,185,0,3,1,1,R,"www.xyzcycles.co.uk"
P1



The file will be preceeded with an ESC char to signify the start of the print and each line will end in a line feed, so I don't want WD or Windows to strip out the ESC chars.

The printer is currently connected as a USB device, but I was thinking that maybe connecting as an LPT device may make it easier?

How have you guys managed to do this? I'm looking for a good (and reliable) solution for this...

Thanks in advance...


Antworten:

It took a bit of thinking about as I've not used the fOpen etc. commands before, but here it is - a simple working Zebra LP 2844 example using the Zebra EPL language commands:


// EXAMPLE - Printing a product label (with barcode) on a Zebra LP 2844

// Device name
glocalsDevice is string = "LPT1"

// String to send to printer
sMyString is string

// Port no. returned from fOpen
glocaliPort is int

// Open the file
glocaliPort = fOpen(glocalsDevice, foCreateIfNotExist)

IF ErrorOccurred THEN
Error("Unable to contact the printer! ", ErrorInfo())
ELSE
// Init the label
sMyString = Charact(10) + "N" + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - Business name
sMyString = "A230,5,0,3,2,2,N," + Charact(34) + "XYZ Cycles" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - Manufacturer name
sMyString = "A230,45,0,3,1,1,N," + Charact(34) + "Shimano" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - Price
sMyString = "A480,45,0,3,1,1,N," + Charact(34) + "1234.99" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - Product name
sMyString = "A230,65,0,3,1,1,N," + Charact(34) + "XT 32 hole hub" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - Product Barcode
sMyString = "B245,90,0,E30,3,5,70,B," + Charact(34) + "123456789012" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send text - web address
sMyString = "A250,185,0,3,1,1,R," + Charact(34) + "www.xyzcycles.co.uk" + Charact(34) + Charact(10)
fWrite(glocaliPort, sMyString)

// Send P1 print buffer contents
sMyString = "P1" + Charact(10)
fWrite(glocaliPort, sMyString)

// Close the file
fClose(glocaliPort)
END


I hope it helps someone...:)

I'll post it on the solutions forum as well :spos:

von DarrenF - am 29.07.2009 23:07
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.