Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143603

Color printer prints only in monochrome

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Version 6.1.7601

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Printer: Lexmark C792, Lexmark Universal v2 PS3

      A DESCRIPTION OF THE PROBLEM :
      The printer is setup to use monochrome by default. After opening the print dialog and selecting color the document is still printed in black and white. When inspecting for supported PrintColor of the printer only MONOCHROME is returned although the printer is a color printer and has color.

      With any other application like Adobe Reader, Microsoft Office etc. the printing is done correctly in color.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Connect Lexmark printer
      Start the application
      Select the Lexmark printer from the dropdown

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The available colors to be COLOR and MONOCHROME
      ACTUAL -
      The available color is MONOCHROME only

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.collections.FXCollections;
      import javafx.print.Printer;
      import javafx.print.PrinterAttributes;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class Main extends Application {

        private Text printerName;
        private Text printerAvailableColors;

        @Override
        public void start(Stage primaryStage) {
          try {
            BorderPane root = new BorderPane();

            printerName = new Text();
            printerAvailableColors = new Text();

            ComboBox<Printer> allPritners = new ComboBox<>();
            allPritners.setItems(FXCollections.observableArrayList(Printer.getAllPrinters()));

            allPritners.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Printer>() {

              @Override
              public void changed(ObservableValue<? extends Printer> observable, Printer oldValue, Printer newValue) {
                showPrinterDetails(newValue);
              }

            });

            allPritners.getSelectionModel().select(Printer.getDefaultPrinter());

            root.setTop(allPritners);

            VBox vBox = new VBox(5);
            vBox.getChildren().addAll(printerName, printerAvailableColors);
            ScrollPane scrollContent = new ScrollPane(vBox);
            scrollContent.setFitToHeight(true);
            scrollContent.setFitToWidth(true);
            root.setCenter(scrollContent);

            Scene scene = new Scene(root, 400, 400);
            primaryStage.setScene(scene);
            primaryStage.show();
          } catch (Exception e) {
            e.printStackTrace();
          }
        }

        private void showPrinterDetails(Printer printer) {
          printerName.setText("Name: " + printer.getName());
          PrinterAttributes printerAttributes = printer.getPrinterAttributes();

          printerAvailableColors.setText("Printer available colors: " + printerAttributes.getSupportedPrintColors().toString());
        }

        public static void main(String[] args) {
          launch(args);
        }
      }

      ---------- END SOURCE ----------

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: