OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.02k stars 182 forks source link

Question: Support for endless rolls with cutters and different page sizes #749

Closed mtremer closed 1 year ago

mtremer commented 1 year ago

Hello,

I am trying to print on a Brother QL-1110NWB. This works well with the IPP Everywhere driver after automatically discovering the printer and adding it to my configuration.

In the printer I have a roll of label paper and the printer has a cutter. Printing works fine and the printer can automatically cut off the tape after each page.

I now have a system that generates different labels of different sizes. Some are being used to label products and boxes - others are for DHL shipment labels and so on. I would like to know if CUPS somehow supports that no fixed page size is configured and is able to print those labels in the form factor they are being received.

The source format is PDF and usually comes readily scaled for the printer and if I print it using an iPhone the printer is doing the "right thing". Using CUPS, each page will be scaled to what I have selected in the printers "default options" and printed - which is not what I want. I am sending the PDF document to cups using the dbus API.

I have now been reading lots of CUPS code, but could not quite make sense of it with sufficient confidence, but I believe that it should generally be possible to just give the width of the roll and CUPS automatically scales (if necessary) the page to the maximum width automatically determining the length.

When asked with ipptool, the printer says this:

media-ready (keyword) = roll_current_102x0mm

So I tried to configure CUPS with something like *DefaultPageSize: Custom.102x0mm which is not giving me what I want. I would have expected CUPS to ask the printer what paper is currently installed (as it is reporting that) and maybe automatically configure itself depending on that information? That does not seem to happen.

Hence I am now trying to reach out to you to help me figure out if this is at all possible what I want to achieve, whether it should work but doesn't or if it is me having misconfigured something. Any pointers are greatly appreciated.

If I could send with each print job what my page size for that label is would also work for me. One PDF has two pages that have different dimensions, but if that is making the case too difficult, I could potentially split that into two print jobs.

I am using CUPS 2.3.3op2 on Debian Bullseye. "get-printer-attributes" and my PPD file are attached. Please let me know if you need any further information.

ipptool-get-printer-attributes.txt Brother_QL-1110NWB.txt

michaelrsweet commented 1 year ago

Sorry, but CUPS and its filters do not support auto-sizing like this - they depend on the submitting application to specify the correct size.

Conceptually you could do a simple wrapper around the "lp" command to examine the file and calculate the necessary dimensions...

mtremer commented 1 year ago

Thank you Michael for your reply.

Sorry, but CUPS and its filters do not support auto-sizing like this - they depend on the submitting application to specify the correct size.

My PDF documents are in the correct size that the printer needs. No problem to do anything in my application if I actually was needed to. So if possible, it would be fine with me if CUPS could just convert the PDF with its dimensions into the raster format and send it to the printer. I was reading through the code at some point thinking that it should generally be possible, but there is a lot of code to read, so surely I misinterpreted some parts.

Conceptually you could do a simple wrapper around the "lp" command to examine the file and calculate the necessary dimensions...

Is there a way that I can pass individual settings for a print job this way? I tried that, but felt like they did not change any behaviour. Neither by printing through lp, nor the dbus interface.

michaelrsweet commented 1 year ago

You can pass options to lp the usual way (lp -o media=a4 -n 4 ...), and they should be honored...