Package javax.print.attribute

Examples of javax.print.attribute.HashPrintServiceAttributeSet


        PrintServiceAttributeSet serviceSet = null;

        if (attributes != null && !attributes.isEmpty()) {

            requestSet = new HashPrintRequestAttributeSet();
            serviceSet = new HashPrintServiceAttributeSet();

            Attribute[] attrs = attributes.toArray();
            for (int i=0; i<attrs.length; i++) {
                if (attrs[i] instanceof PrintRequestAttribute) {
                    requestSet.add(attrs[i]);
View Full Code Here


    }


    @Override
    public PrintServiceAttributeSet getAttributes(){
        PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
        attrs.add(getPrinterName());
        PrinterIsAcceptingJobs acptJobs = getAttribute(PrinterIsAcceptingJobs.class);
        if(acptJobs != null){
            attrs.add(acptJobs);
        }
        PrinterState prnState = getAttribute(PrinterState.class);
        if(prnState != null){
            attrs.add(prnState);
        }
        PrinterStateReasons prnStateReasons = getAttribute(PrinterStateReasons.class);
        if(prnStateReasons != null){
            attrs.add(prnStateReasons);
        }
        QueuedJobCount jobCount = getAttribute(QueuedJobCount.class);
        if(jobCount != null){
            attrs.add(jobCount);
        }
        // TODO: Seems to be more accurate than settings.get_SupportsColor(), which doesn't work for CutePDF
        if(settings.get_DefaultPageSettings().get_Color()){
            attrs.add(ColorSupported.SUPPORTED);
        }else{
            attrs.add(ColorSupported.NOT_SUPPORTED);
        }

        return AttributeSetUtilities.unmodifiableView(attrs);
    }
View Full Code Here

            // Print is sent
            DocFlavor psInFormat = new DocFlavor.INPUT_STREAM(printerContentType);
            InputStream bais = new ByteArrayInputStream(baos.toByteArray());
           
            Doc myDoc = new SimpleDoc(bais, psInFormat, null);
            PrintServiceAttributeSet psaset = new HashPrintServiceAttributeSet();
            if (UtilValidate.isNotEmpty(printerName)) {
                try {
                    URI printerUri = new URI(printerName);
                    PrinterURI printerUriObj = new PrinterURI(printerUri);
                    psaset.add(printerUriObj);
                } catch (URISyntaxException ue) {
                    Debug.logWarning(ue, "Invalid URI for printer [" + printerName + "]", module);
                }
            }
            //PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, psaset); // TODO: selecting the printer by URI seems to not work
View Full Code Here

TOP

Related Classes of javax.print.attribute.HashPrintServiceAttributeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.