Java Printer Usage isValueSupported(PrintService ps, Attribute attr, DocFlavor flavor, AttributeSet attributes)

Here you can find the source of isValueSupported(PrintService ps, Attribute attr, DocFlavor flavor, AttributeSet attributes)

Description

is Value Supported

License

GNU General Public License

Declaration

public static boolean isValueSupported(PrintService ps, Attribute attr,
            DocFlavor flavor, AttributeSet attributes) 

Method Source Code

//package com.java2s;
/*/*  w ww  .  j ava2s .  c o m*/
 * Copyright (C) 2015  University of Oregon
 *
 * You may distribute under the terms of either the GNU General Public
 * License or the Apache License, as specified in the LICENSE file.
 *
 * For more information, see the LICENSE file.
 */

import javax.print.*;

import javax.print.attribute.*;

public class Main {
    public static boolean isValueSupported(PrintService ps, Attribute attr,
            DocFlavor flavor, AttributeSet attributes) {
        boolean retVal = false;

        if (ps == null || !isGoodPrinterName(ps.getName()))
            return retVal;

        try {
            retVal = ps.isAttributeValueSupported(attr, flavor, attributes);
        } catch (Exception e) {
            retVal = false;
        }
        return retVal;
    }

    public static boolean isGoodPrinterName(String name) {
        if (name == null)
            return false;
        if (name.equals("jeff_pl") || name.equals("jeff_pr"))
            return false;
        if (name.equals("steve_pl") || name.equals("steve_pr"))
            return false;

        return true;
    }
}

Related

  1. getPrintServices()
  2. getResolution(PrintService service, PrintRequestAttributeSet set, boolean tryDefaultIfNull)
  3. getSetting(PrintService service, PrintRequestAttributeSet set, Class type, boolean tryDefaultIfNull)
  4. getSupportedAttributes(PrintService p)
  5. getSupportedAttrName(Class clazz)
  6. lookupMediaSize(final Media media)
  7. lookupPrintNames(PrintService[] prtSrvs)
  8. lookupPrintService()
  9. lookupPrintServices()