Working configuration for printing 4x6 labels (eBay shipping labels, etc.) to a Godex RT730i over Ethernet from Kubuntu, using Godex's own rastertoezpl CUPS driver (EZPL, the printer's native language).
Printer: Godex RT730i, firmware V1.130, direct thermal, network address 10.1.6.46
Host: Kubuntu 26.04, CUPS with AppArmor confining cupsd
Driver: rastertoezpl-1.1.2 from the Godex downloads page (Linux CUPS driver)
| # | Problem | Fix |
|---|---|---|
| 1 | Driver built without the CUPS headers produced zero-length output | Install libcups2-dev before ./configure, then rebuild |
| 2 | AppArmor blocked cupsd from executing the filter through a symlink into /usr/local/libexec/ |
Replace the symlink in /usr/lib/cups/filter/ with a real copy of the binary |
| 3 | PPD default page size is 100 x 50 mm (w283h142) — a third of a 4x6 label |
Set the queue default to w283h425 (100 x 150 mm), or pass an exact size per job |
| 4 | The generic Zebra ZPL queue (godex) blanked labels and overwrote printer settings |
Don't use ZPL emulation; use the Godex EZPL queue only, and reset the printer settings |
| 5 | Okular's print dialog adds 0.14 in margins that reset every time, shrinking and offsetting the label | Not solved in Okular. Print with a launcher script that calls lp with an exact size (section 7) |
./configure does not detect a missing libcups2-dev. The build succeeds, but the resulting filter produces zero-length output.
sudo apt install build-essential libcups2-dev
cd ~/src/rastertoezpl-1.1.2
./configure
make
sudo make installThe install puts the filter at /usr/local/libexec/rastertoezpl/rastertoezpl and links it from /usr/lib/cups/filter/rastertoezpl.
Check that the binary has no missing libraries (should print nothing):
ldd /usr/local/libexec/rastertoezpl/rastertoezpl | grep "not found"Symptom: the queue accepts jobs but zero bytes reach the printer. The kernel log shows:
apparmor="DENIED" operation="exec" profile="/usr/sbin/cupsd"
name="/usr/local/libexec/rastertoezpl/rastertoezpl" ... comm="cups-exec"
AppArmor checks the resolved path of the symlink, and the cupsd profile doesn't allow executing anything under /usr/local/libexec/. The filter works from a shell because AppArmor doesn't confine your shell, which is why manual conversion tests succeed while real jobs fail.
Fix: replace the symlink with a real copy in the standard filter directory:
sudo rm /usr/lib/cups/filter/rastertoezpl
sudo install -m 755 -o root -g root \
/usr/local/libexec/rastertoezpl/rastertoezpl \
/usr/lib/cups/filter/rastertoezpl
ls -l /usr/lib/cups/filter/rastertoezpl # must be a regular file, no "->"Repeat this copy after every rebuild or upgrade of the driver, or the zero-byte symptom returns.
Look for new denials with:
sudo journalctl -k | grep -i apparmor | grep -i denied | tail(Denials for fusermount3, bitwarden-app, gs reading /etc/passwd, and the usb thread's net_admin request are unrelated to this problem.)
The PPD was moved to:
/usr/local/share/ppd/godex/godex-rt730i.ppd
Use the RT730i PPD, not the RT730x. Its cupsFilter line names the filter:
*cupsFilter: "application/vnd.cups-raster 50 rastertoezpl"
Note: the AppArmor denial was for the filter binary, not the PPD. CUPS keeps its own copy of the PPD in /etc/cups/ppd/. The move is tidy but wasn't confirmed as necessary; the filter copy in section 3 is what fixed the problem.
In KDE's printer settings choose AppSocket/HP JetDirect, address 10.1.6.46, and select the RT730i PPD. The equivalent command line is:
sudo lpadmin -p godex_RT730i -E -v socket://10.1.6.46:9100 \
-P /usr/local/share/ppd/godex/godex-rt730i.ppdThe RT730i PPD lists sizes as w<width>h<height> in points (72 pt = 1 inch). It has no exact 4x6 in entry.
| Name | Size | Notes |
|---|---|---|
w283h142 |
100 x 50 mm | PPD built-in default. A third of a 4x6 label; never rely on it |
w283h425 |
100 x 150 mm | Queue default (set below). Nearest listed size. PPD imageable area is the full page (0 0 283 425) with *HWMargins: 0 0 0 0; a terminal job at this size gives ^Q150,2 ^W100 |
Custom.4x6in |
288 x 432 pt (4 x 6 in) | Exact size via Custom.WIDTHxHEIGHT; accepted by the filter, but see the note below |
A correct job header from this driver for a 4x6 label looks like this (checked offline):
^Q152,2 label length 152 mm, gap 2 mm
^W101 label width 101 mm
~R200
^P1 one copy
^L start of label format, then image data
sudo lpadmin -p godex_RT730i -o PageSize=w283h425A named size is used as the default instead of Custom.4x6in because a custom default doesn't show up as a selectable entry in GUI dialogs. With Custom.4x6in as the default, lpoptions -l puts its * marker on the Custom.WIDTHxHEIGHT template (it can't display the dimensions), and KDE System Settings > Printers shows the Media Size box blank. The trade-off is that w283h425 is about 1.6 mm narrower and 2.4 mm shorter than a true 4 x 6 in label. Captures of terminal jobs at both sizes had the same image row width (143 bytes), which suggests the label content isn't rescaled in the driver.
# PPD option list: the * marks the current default, and should sit on w283h425
lpoptions -p godex_RT730i -l | grep -i PageSize
# Options currently set for this queue
lpoptions -p godex_RT730i
# Stored server-side setting
sudo grep -n -i pagesize /etc/cups/printers.confThe * in the first command follows the queue default, so it is a valid check. The real test is to print a label with no -o PageSize option and confirm it comes out full length.
In KDE System Settings > Printers > select the queue > Configure > Media Settings, set Media Size to the 100 x 150 mm entry (may be labelled w283h425). It is the same setting the lpadmin command applies. The other values there (300 DPI, label gap 2 mm, no black mark) match what the driver sends, so leave them.
An exact 4 x 6 in size is still available per job:
lp -d godex_RT730i -o PageSize=Custom.4x6in "label.pdf"Printing from GUI applications, and why Okular's print dialog can't currently be used for exact-size labels, is covered in section 7.
Okular's print dialog (Properties) shows the paper as 100x150mm but margins of 0.14 in (3.56 mm) on all four sides, and the margins reset to 0.14 in every time the dialog is opened. The print preview is built separately from the dialog and shows a page much larger than the label (roughly Letter/A4 shaped), so it is not a reliable guide to what will print.
Captured job headers (via a temporary capture queue, section 10) show the effect:
Terminal lp -o PageSize=w283h425 |
From Okular (100x150mm, 0.14 in margins) | |
|---|---|---|
^Q label length |
150 mm | 143 mm |
^W label width |
100 mm | 93 mm |
| Image start (x, y in dots) | 16, 59 | 64, 147 |
| Image row width | 143 bytes | 121 bytes |
The size arithmetic matches: 100 mm - 2 x 3.56 mm = 92.9 mm (^W93) and 150 mm - 7.1 mm = 142.9 mm (^Q143). The image row width is about 85% of the terminal job's. So a label sent from Okular would print smaller and offset from the label edges.
The margins are not in the PPD (*HWMargins: 0 0 0 0, *ImageableArea: 0 0 283 425), and the queue and driver handle the size correctly from the terminal. The shrinking comes from Okular's print path.
Also observed:
- Launching Okular as
PRINTER=godex_RT730i okular label.pdfchanged the dialog's paper size to 100x150mm, but the margins stayed at 0.14 in and the captured header still read^Q143 ^W93. - The dialog and preview seem to start from the default printer (an HP on this machine), and the 0.14 in margins may be that printer's. This is a theory, not confirmed.
Not tested: setting the margins to 0 in Properties and printing within that same dialog session (they don't persist, so it would have to be repeated for each print), and printing the same PDF from Firefox or Evince.
Status: Okular integration is unresolved. Don't print labels from Okular's dialog unless a capture shows ^Q150 ^W100.
lp with an exact size gave correct output in every test. Save this as ~/.local/bin/print-godex.sh. The first line (shebang) is required. Without it the script still runs from a terminal (the shell falls back to sh), but the Dolphin entry did nothing until the shebang was added. The likely cause is an "Exec format error" that Terminal=false hides:
#!/bin/sh
/usr/bin/lp -d godex_RT730i -o PageSize=Custom.4x6in "$1"chmod +x ~/.local/bin/print-godex.shSave this as ~/.local/share/applications/print-label.desktop:
[Desktop Entry]
Type=Application
Name=Print 4x6 label
Exec=/home/bedge/.local/bin/print-godex.sh %f
MimeType=application/pdf;
Icon=printer
Terminal=falseRefresh the caches if the entry doesn't appear or a stale copy is used:
update-desktop-database ~/.local/share/applications
kbuildsycoca6Dolphin then shows Print 4x6 label in the right-click / Open With menu for PDFs. To debug a launcher that does nothing, set Terminal=true temporarily so errors are visible, and run desktop-file-validate on the .desktop file.
Under Configuration > Printer Configuration, the working values are:
| Setting | Value |
|---|---|
| Printing Mode | Direct Thermal |
| Paper Setup | Gap Paper |
| Sensing Mode | Auto Select |
| ADJ Stop Position | 27 |
| Option Setup | Cutter Mode |
Sensing Mode had been changed to See-Through and ADJ Stop Position to 41. Reset both, then run the front-panel C-button calibration on your label stock.
The earlier queue used the generic Zebra ZPL driver, which relies on the printer's ZPL emulation. Every ZPL job, even a minimal ^XA...^XZ sent straight to port 9100 with no CUPS involved, produced a partial strip, a blank label, a second label minus the same strip, no ink, and a "check media" beep. Every ZPL job also flipped ADJ Stop Position to 41. Remove that queue so it can't be used by accident:
sudo lpadmin -x godexOffline conversion (nothing goes to the printer):
cupsfilter -p /etc/cups/ppd/godex_RT730i.ppd -m application/vnd.cups-raster \
-o PageSize=Custom.4x6in "label.pdf" > /tmp/label.ras
PPD=/etc/cups/ppd/godex_RT730i.ppd /usr/lib/cups/filter/rastertoezpl \
1 user title 1 "PageSize=Custom.4x6in" < /tmp/label.ras > /tmp/label.ezpl
wc -c /tmp/label.ezpl # about 96 KB for a typical label
tr -d '\000\377' < /tmp/label.ezpl | wc -c # thousands = real image content
head -c 200 /tmp/label.ezpl | cat -v # header should be readable EZPLCapture what CUPS actually sends (needs two terminals):
sudo lpadmin -p godex-capture -E -v socket://127.0.0.1:9100 \
-P /etc/cups/ppd/godex_RT730i.ppd
# Terminal A: leave running; exits on its own when the job ends
nc -l 127.0.0.1 9100 > /tmp/captured.ezpl
# Terminal B:
lp -d godex-capture -o PageSize=Custom.4x6in "label.pdf"
wc -c /tmp/captured.ezpl # should match the offline file
sudo journalctl -k | grep -i apparmor | grep -i denied | tail -3
# Cleanup
sudo lpadmin -x godex-captureTroubleshooting:
| Symptom | Likely cause |
|---|---|
Job completes, 0 bytes sent, Page drawing error in error_log |
Filter blocked by AppArmor (section 3) |
| Zero-length output from a manual filter run | Built without libcups2-dev (section 2) |
| Label prints at a third of the length | PPD default size w283h142 in use (section 6) |
| Settings changed after a job | A ZPL job was sent (section 9) |
| Label prints smaller and offset from a GUI app | The app's print margins (section 7). Use the launcher, or check that a capture shows ^Q150 ^W100 |
| Feeds a blank label or beeps "check media" | Reload the config page; check Sensing Mode, then run C-button calibration |
- Reload
http://10.1.6.46, confirm the values in section 8 (screenshot as a baseline). lpstat -o— clear any stuck jobs withcancel -a godex_RT730i.- Print one label; keep
cancel -a godex_RT730iready. - Reload the config page afterward and check nothing changed.