1

I have added a custom format to /etc/cups/ppd/GK420.ppd in order to match my 70x50mm labels.

*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: w198h141
*PageSize w198h141/70x50mm: "<</PageSize[198 141]/ImagingBBox null>>setpagedevice"
*PageSize w90h18/1.25x0.25": "<</PageSize[90 18]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: w198h141
*PageRegion w198h141/70x50mm: "<</PageSize[198 141]/ImagingBBox null>>setpagedevice"
*PageRegion w90h18/1.25x0.25": "<</PageSize[90 18]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: w198h141
*ImageableArea w198h141/70x50mm: "0 0 198 141"
*ImageableArea w90h18/1.25x0.25": "0 0 90 18"
*DefaultPaperDimension: w198h141
*PaperDimension w198h141/70x50": "198 141"
*PaperDimension w90h18/1.25x0.25": "90 18"
*MaxMediaWidth: "576"
*MaxMediaHeight: "3600"
*HWMargins: 0 0 0 0
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 36 576
*ParamCustomPageSize Height: 2 points 36 3600
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0

Printing from gEdit or LibreOffice, my text is not properly aligned : printing starts well before the left border of the label.

If I print using Windows XP and the Seagull driver, the same .odt file (I use a virtual machine on the Linux host where CUPS is installed) prints properly.

When I return to Linux and print again, the alignment is correct.

My best guess is the the Windows driver sends a config command to the printer, that remains effective when printing from Linux. If I turn off and on the printer, the problem reappears when printing from Linux.

I find it strange that I haven't been able to find any information related to this problem though Zebra printers are quite popular... Am I the only one using Linux to print labels ;-)

ballatom
  • 21
  • 4
  • Show how you modified the PPD file. – wurtel Aug 06 '18 at 06:51
  • I have added the (hopefully) relevant part of the ppd. I hope it's clear enough so you can figure out what I have modified. Thanks. – ballatom Aug 08 '18 at 10:14
  • Looks fine... Can you access the web interface? Check the settings for offset / resolution etc. before and after printing from windows, see if you can find anything that's changed. Perhaps even try saving settings as default after printing from windows. I haven't had this problem myself. Orientation / size is correct when the offset is wrong? – wurtel Aug 08 '18 at 10:56
  • The printer was connected through USB. I connected it to the network and found out that setting the print width to 550 instead of the default 832 solves my problem. The Windows XP driver however works differently : it sets the default print width to 832 (max value) but somehow gets the text at the right place on the label. I will try to set 550 as default and see what effect printing from Windows has. Thanks a lot for the pointing at the web interface of the printer. – ballatom Aug 09 '18 at 08:41

1 Answers1

1

Unfortunately, CUPS does not center the page content for you, nor does it support a setting to adjust the horizontal offset.

Old Zebra printers had the labels sitting against the left edge, but the more recent ones (e.g. gk420 or zd420) have the labels centered. CUPS offers a setting for vertical offset (i.e. zeLabelTop), but not for horizontal offset.

However, the horizontal offset can be adjusted using the ZPL command ^LS. This adjusts the horizontal offset for all print instructions, and the setting is retained until the printer is turned off.

This is also the reason why it works after printing on windows. It probably sets the offset, and you didn't restart the printer before printing on linux.

Until CUPS supports a horizontal offset setting, printing on windows first and not restarting the printer is your only (feasible) option.

More information here: https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf

The ^LS command allows for compatibility with Z-130 printer formats that are set for less than full label width. It is used to shift all field positions to the left so the same commands used on a Z-130 or Z-220 Printer can be used on other Zebra printers.

...

To be compatible with existing Zebra printers, this command must come before the first ^FS (Field Separator) command. Once you have issued an ^LS command, the setting is retained until you turn off the printer or send a new ^LS command to the printer.

I believe this is the CUPS code that converts your document to ZPL: https://github.com/apple/cups/blob/master/filter/rastertolabel.c

Robert Ende
  • 111
  • 1