Skip to content

libppd remaps print-color-mode=bi-level, no 1-bit PWG output possible #91

Closed

Description

@ValdikSS

Describe the bug

If the printer reports support for 1-bit bi-level raster (print-color-mode=bi-level, pwg-raster-document-type=black_1), libppd will remap -o print-color-mode=bi-level to =monochrome, because the ippeve generator uses ColorModel=FastGray for 1-bit output, but libppd remaps FastGray to print-color-mode=monochrome instead of =bi-level.

libppd/ppd/ppd-cache.c

Lines 386 to 395 in 4afdca9

if ((choice = ppdFindMarkedChoice(ppd, "ColorModel")) != NULL)
{
//
// ColorModel is taken from PPD as its default option.
//
if (!strcmp(choice->choice, "Gray") ||
!strcmp(choice->choice, "FastGray") ||
!strcmp(choice->choice, "DeviceGray"))
keyword = "monochrome";

To Reproduce

PPD file has:

*cupsFilter2: "image/pwg-raster image/pwg-raster 100 -"
*OpenUI *ColorModel: PickOne
*OrderDependency: 10 AnySetup *ColorModel
*en_US.Translation ColorModel/Color Mode: ""
*ColorModel Gray: "<</cupsColorSpace 18/cupsBitsPerColor 8/cupsColorOrder 0/cupsCompression 0>>setpagedevice"
*ColorModel FastGray: "<</cupsColorSpace 3/cupsBitsPerColor 1/cupsColorOrder 0/cupsCompression 0>>setpagedevice"
*en_US.ColorModel Gray/Grayscale: ""
*DefaultColorModel: FastGray
*CloseUI: *ColorModel

I'm printing with: lp -d testp_l -o ColorModel=FastGray -o print-color-mode=bi-level -o page-ranges=1 document-a4.pdf

And the result:

D [22/Oct/2026:16:53:03 +0300] [Job 36] cfFilterGhostscript: Ghostscript command line: gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -sMediaClass=PwgRaster -sOutputType=automatic -r300x300 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=18 -dcupsBorderlessScalingFactor=0.0000 -dcupsInteger1=1 -dcupsInteger2=1 -scupsRenderingIntent=auto -scupsPageSizeName=A4 -dcupsManualCopies -I/usr/share/cups/fonts -sOutputICCProfile=sgray.icc -c -f -_

Second bug, in libcupsfilters: OpenPrinting/libcupsfilters#298

Activity

  1. DSingh0304 commented on Nov 13, 2026

    @DSingh0304
    Contributor

    I'd like to fix this one. In ppdConvertOptions() (ppd-cache.c), FastGray always becomes "monochrome", so bi-level is never requested. I'll map it to bi-level when the printer supports it and add a test.

  2. ValdikSS commented on Nov 13, 2026

    @ValdikSS
    MemberAuthor

    Keep in mind that the IPP printer might have black_1 in pwg-raster-document-type-supported only, but announce print-color-mode-supported=monochrome, without bi-level. That's also acceptable according to specification as far as I could see.

    This means that CUPS, somehow, needs to generate 1-bit output even with print-color-mode=monochrome, if the printer has only pwg-raster-document-type=black_1.

    But maybe that could be seen as another bug, and probably not in libppd.
    Also see OpenPrinting/libcupsfilters#298

  3. DSingh0304 commented on Nov 13, 2026

    @DSingh0304
    Contributor

    Keep in mind that the IPP printer might have black_1 in pwg-raster-document-type-supported only, but announce print-color-mode-supported=monochrome, without bi-level. That's also acceptable according to specification as far as I could see.

    This means that CUPS, somehow, needs to generate 1-bit output even with print-color-mode=monochrome, if the printer has only pwg-raster-document-type=black_1.

    But maybe that could be seen as another bug, and probably not in libppd. Also see OpenPrinting/libcupsfilters#298

    Thanks @ValdikSS , that makes sense. I opened #106 for the bi-level case here. A printer with only black_1 that lists monochrome still gets monochrome; I left that for libcupsfilters #298 . I can look at that one next if nobody else is on it.

  4. added a commit that references this issue on Nov 15, 2026
    cd861ba
  5. darkvision77 commented on Nov 15, 2026

    @darkvision77

    I'm not sure about closing this one too.

    If I have a printer that reports print-color-mode-supported=bi-level, it still gets monochrome (PPD from driverless). This happens regardless of whether lp is run without arguments or with -o ColorModel=FastGray -o print-color-mode=bi-level.

    If I pass only -o print-color-mode=bi-level to lp, something really strange happens:

    bi-level+monochrome/black_1             colorMode=color    bpp=1 colorspace=3 # ??
    bi-level+monochrome/sgray_1+black_8     colorMode=bi-level bpp=1 colorspace=18
    bi-level/black_1                        colorMode=color    bpp=1 colorspace=3 # ??
    monochrome+bi-level/black_1             colorMode=bi-level bpp=1 colorspace=3
    monochrome/black_1                      colorMode=bi-level bpp=1 colorspace=3 # ??
    

    Where bi-level+monochrome/sgray_1+black_8 means that the printer reports print-color-mode-supported=bi-level,monochrome (default: bi-level) and pwg-raster-document-type-supported=sgray_1,black_8 (default: sgray_1).

  6. DSingh0304 commented on Nov 15, 2026

    @DSingh0304
    Contributor

    I'm not sure about closing this one too.

    If I have a printer that reports print-color-mode-supported=bi-level, it still gets monochrome (PPD from driverless). This happens regardless of whether lp is run without arguments or with -o ColorModel=FastGray -o print-color-mode=bi-level.

    If I pass only -o print-color-mode=bi-level to lp, something really strange happens:

    bi-level+monochrome/black_1             colorMode=color    bpp=1 colorspace=3 # ??
    bi-level+monochrome/sgray_1+black_8     colorMode=bi-level bpp=1 colorspace=18
    bi-level/black_1                        colorMode=color    bpp=1 colorspace=3 # ??
    monochrome+bi-level/black_1             colorMode=bi-level bpp=1 colorspace=3
    monochrome/black_1                      colorMode=bi-level bpp=1 colorspace=3 # ??
    

    Where bi-level+monochrome/sgray_1+black_8 means that the printer reports print-color-mode-supported=bi-level,monochrome (default: bi-level) and pwg-raster-document-type-supported=sgray_1,black_8 (default: sgray_1).

    #106 fixed the mapping in libppd's ppdConvertOptions(), which is what the issue pointed to. What you see with lp comes from CUPS's own copy, _cupsConvertOptions() in cups/ppd-cache.c (used by backend/ipp.c), which still maps FastGray to monochrome. So the libppd fix is correct, but the same change is needed in OpenPrinting/cups for normal printing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions