I've been tearing my hair out over trying to automate printing asset tags from a scanned value to a Zebra ZD420. The label contains a company logo (CompanyLogo.PNG, converted to CompanyLogo.GRF), small message, and barcode that will correspond to the serial number of a laptop. Here's the ZPL code:
^XA
^FO13,14^XGE:COMPANYLOGO.GRF
^FT0,111^AAN,18,10^FB406,1,0,C^FH\^FDProperty of Company, Inc^FS
^FT0,129^AAN,18,10^FB406,1,0,C^FH\^FDIf found please contact:^FS
^FT0,147^AAN,18,10^FB406,1,0,C^FH\^FDemail@company.com^FS
^BY3,3,64^FT35,223^BCN,,Y,N
^FH\^FD>:SERIAL#^FS
^XZ
The ZD420 has no screen so the easiest way I could think to create a scan-and-print label system was to automate via PowerShell. The issue is that I'm unable to print the label with the logo at all.
Running "^XA^FO0,0^XGE:COMPANYLOGO.GRF^XZ" | Out-Printer -Name ZebraGeneric
prints a label with the logo on it without issue (where ZebraGeneric in this case is the Zebra printer Generic / Text Only driver). However, running the following:
"^XA
^FO13,14^XGE:COMPANYLOGO.GRF
^FT0,111^AAN,18,10^FB406,1,0,C^FH\^FDProperty of Company, Inc^FS
^FT0,129^AAN,18,10^FB406,1,0,C^FH\^FDIf found please contact:^FS
^FT0,147^AAN,18,10^FB406,1,0,C^FH\^FDemail@company.com^FS
^BY3,3,64^FT35,223^BCN,,Y,N
^FH\^FD>:SERIAL#^FS
^XZ" | Out-Printer -Name ZebraGeneric
...prints a label that has no logo on it. I have no idea why this is occurring or what limitations are being imposed via the driver or PowerShell to prevent the logo from being printed. The printer has no issue printing with ZebraDesigner.
Also, if you know a better way I can create a scan-and-print system where I can scan or type in a serial number and have it print a label for me, I am very very open to new suggestions.
I was missing some additional parameters for the ^XG
command. The command is meant to be called as such:
^XGd:o.x,mx,my
d = stored media letter
o = filename
x = file extension
mx = scale factor on x axis
my = scale factor on y axis
I corrected these fields and everything appears to work as normal. I also appended ^FS
to the command to properly terminate the line per recommendation from Zebra
The new command is
^XGE:COMPLOGO.GRF,1,1^FS
(please note for any future reference that the name of any stored image on a zebra printer must be capped at 8 characters)