Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colorType is ignored on macOS #1155

Open
tresf opened this issue Jul 6, 2023 · 2 comments
Open

colorType is ignored on macOS #1155

tresf opened this issue Jul 6, 2023 · 2 comments
Assignees

Comments

@tresf
Copy link
Contributor

tresf commented Jul 6, 2023

Steps to reproduce:

  1. Using a Mac on Apple Silicon or Intel
  2. Load https://demo.qz.io
  3. Search for a printer capable of printing in color
  4. From the Pixel tab, next to "Color Type", select "Black & White"
  5. Click "Print HTML" button
  6. Observe that the document is still printed in color

if (pxlOpts.getColorType() != null) {
settings.setPrintColor(getColor(pxlOpts));
}

Upstream bug filed (private) as QZ-12.

@tresf tresf changed the title colorType is ignored for HTML printing colorType is ignored on macOS Jul 7, 2023
@tresf tresf removed the javafx label Jul 7, 2023
@tresf
Copy link
Contributor Author

tresf commented Aug 13, 2023

It appears MacOS may be missing an API for this... here's how Firefox does it...

// There's no standard setting in Core Printing for monochrome. Or rather,
// there is (PMSetColorMode) but it does nothing. Similarly, the relevant gtk
// setting only works on Windows, yay.
//
// So on CUPS the right setting to use depends on the print driver. So we set /
// look for a variety of driver-specific keys that are known to work across
// printers.
//
// We set all the known settings, because the alternative to that is parsing ppd
// files from the printer and find the relevant known choices that can apply,
// and that is a lot more complex, similarly sketchy (requires the same amount
// of driver-specific knowledge), and requires using deprecated CUPS APIs.
#define CUPS_EACH_MONOCHROME_PRINTER_SETTING(macro_)                           \
  macro_("ColorModel", "Gray")                    /* Generic */                \
      macro_("BRMonoColor", "Mono")               /* Brother */                \
      macro_("BRPrintQuality", "Black")           /* Brother */                \
      macro_("CNIJGrayScale", "1")                /* Canon */                  \
      macro_("CNGrayscale", "True")               /* Canon */                  \
      macro_("INK", "MONO")                       /* Epson */                  \
      macro_("HPColorMode", "GrayscalePrint")     /* HP */                     \
      macro_("ColorMode", "Mono")                 /* Samsung */                \
      macro_("PrintoutMode", "Normal.Gray")       /* Foomatic */               \
      macro_("ProcessColorModel", "Mono")         /* Samsung */                \
      macro_("ARCMode", "CMBW")                   /* Sharp */                  \
      macro_("XRXColor", "BW")                    /* Xerox */                  \
      macro_("XROutputColor", "PrintAsGrayscale") /* Xerox, bug 1676191#c32 */ \
      macro_("SelectColor", "Grayscale")          /* Konica Minolta */         \
      macro_("OKControl", "Gray")                 /* Oki */                    \
      macro_("BLW", "TrueM")                      /* Lexmark */                \
      macro_("EPRendering", "None")               /* Epson */

@tresf
Copy link
Contributor Author

tresf commented Aug 29, 2023

@tresf tresf added the upstream label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants