[cups] Auto-reformatting shipping labels for a 4x6 thermal printer
Nick Bogdanov <[email protected]> Sun, 18 Jun 2023 14:59:07 -0700
| Newsgroups | gmane.comp.printing.cups.general |
|---|---|
| Message-ID | <CAF-pz-0p4fGNc1MO5sWjVHz+PVVYXsOtVn-hTvUc8f6SfkeGZA@mail.gmail.com> |
I started doing small-scale e-commerce projects, and found that manually feeding US Letter (8.5x11) sticky labels through my old LaserJet 5L was a pain. So I bought a surplus Zebra GK420d thermal label printer, plugged it into my network, and loaded it up with a spool of 4x6 shipping labels. The Zebra printer speaks ZPL and works flawlessly with CUPS. I have been very happy with it so far. This arrangement is fairly painless when an online service (e.g. FedEx) provides a PDF with a label specifically formatted for 4x6 label printers. It's more of a hassle when they only want to provide PDFs sized for US Letter printers, with 2 labels per sheet (or 1 label per half sheet). If you purchase bulk shipping labels from eBay, for instance, there is no option to request 4x6 labels; they just send you one giant PDF with 2 labels per 8.5x11 page. If you try to print this to the 4x6 Zebra printer, the labels get completely mangled; usually it gets cut off right in the middle. The workarounds I found searching online involved manually importing each bulk label PDF into Adobe Acrobat and cropping it by hand. This isn't a very scalable solution and there ought to be a way to make the software do the heavy lifting for us. What I'd like to do is have CUPS notice that I'm printing an 8.5x11 sheet of labels to a 4x6 form factor printer, and automatically reformat each label on the page to fit the 4x6 media. I would also like to have the ability to optionally resize it to fit on smaller 4x3 labels, which are more convenient for tiny packages. What would be a good way to approach this? I would be comfortable writing some code if needed. I don't know the CUPS architecture at all, though, and I'm not sure where to start. cc: Michael since he seems to be the main contributor to filter/rastertolabel.c _______________________________________________ cups mailing list [email protected] https://lists.cups.org/mailman/listinfo/cups