kylemacfarlane / zplgrf

Python utilities for converting to and from ZPL, GRF, PDF, and images
GNU General Public License v3.0
52 stars 11 forks source link

CUPS filter not working #11

Open andersonls opened 1 year ago

andersonls commented 1 year ago

The provided CUPS filter is not working properly.

The grf = GRF.from_pdf(pdf.read(), 'CUPS') on line 22 returns a list, so the grf.optimise_barcodes() and grf.to_zpl calls doesn't work.

What i did was change to always get the first element, but i'm not sure how it would work when printing multiple pages.

kylemacfarlane commented 1 year ago

Thanks, I will look into it at same point.

But really the cups filter should be considered deprecated as the problem was fixed in CUPS itself back in 2016: https://bugs.linuxfoundation.org/show_bug.cgi?id=1373

Assuming you are using cups-filter 1.11.4+ you can edit the .ppd file for your printer to add the following to the end:

*OpenUI *CenterOfPixel/Center Of Pixel: PickOne
*OrderDependency: 20 AnySetup *CenterOfPixel
*DefaultCenterOfPixel: true
*CenterOfPixel true/true: ""
*CenterOfPixel false/false: ""
*CloseUI: *CenterOfPixel

(I think this is correct, it's been 7 years so maybe I've forgotten)

Then in the CUPS web UI there will now be a select box to turn CenterOfPixel on/off. Turning it on will solve the barcode issue without using my crappy slow filter.