OpenPrinting / cups

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

`ippeveprinter` `-F output-type/subtype` argument doesn't do anything #744

Closed x0ul closed 1 year ago

x0ul commented 1 year ago

Is your feature request related to a problem? Please describe. The manual for ippeveprinter (https://openprinting.github.io/cups/doc/man-ippeveprinter.html) says:

-F output-type/subtype[,...]
    Specifies the output MIME media type. The default is "application/postscript" when the -P option is specified. 

and also...

the "OUTPUT_FORMAT" environment variable contains the output MIME media type

While I see the argument supplied to -F eventually make its way to the OUTPUT_FORMAT environment variable, this has no actual effect on the file produced.

This StackOverflow post (https://stackoverflow.com/questions/69883878/setting-up-a-print-to-disk-system-with-ippeveprinter) suggests passing -c ippeveps to ippeveprinter to get format conversions working, but concedes that one is only able to output PostScript regardless of the arguments given to ippeveprinter.

Describe the solution you'd like I would like the -F argument to control the format of the file output as indicated in the documentation.

Describe alternatives you've considered I could use script something up using programs like ps2pdf and ImageMagick to convert the output into various image formats.

Additional context The OUTPUT_FORMAT environment variable is filled by ippeveprinter in with the value of -F argument. I wrote a very short script:

env > /tmp/env
echo "$*" > /tmp/args

and passed it using -c to ippeveprinter to verify, eg., ippeveprinter -F "some/thing" ... yields OUTPUT_TYPE=some/thing in the /tmp/env file.

I searched the source of ippeveps.c (https://github.com/OpenPrinting/cups/blob/a8eaa67dd10dbaa7856b436ad921ad748f7de0bb/tools/ippeveps.c) and found no mentions of OUTPUT_FORMAT. Everything I see hard-codes output formats to PostScript.

zdohnal commented 1 year ago

Hi,

the thing I know for sure is ippeveps is not supposed to create every output you can imagine - its purpose is to convert any->Postscript. ippevepcl works the same way. IIUC -F sets the output format but it is expected to be passed to a filter defined by -c parameter, which will be run on incoming file and create the desired output. Or you can use -f parameter and if there is possible conversion path in CUPS MIME database, CUPS will start filters for you and send the result to the ippeveprinter.

@michaelrsweet do I understand it correctly?

michaelrsweet commented 1 year ago

@zdohnal Yes, ippeveprinter is just a front end for the filter program you specify with '-c', and the '-F' option tells that program what format to convert to, in the event that is supports multiple formats (like ippsample's "ipptransform" program).

Generally speaking CUPS will convert to one of the supported formats reported by ippeveprinter (via the '-f' option), e.g., image/pwg-raster, which then get passed to the filter program ('-c') which converts it to the output format.

zdohnal commented 1 year ago

Ok, so I would update the man page to reflect this.

x0ul commented 1 year ago

Ah, got it, thanks for the speedy replies :)