Package javax.print.attribute

Examples of javax.print.attribute.HashPrintRequestAttributeSet


        printService = PrintServiceLookup.lookupDefaultPrintService();
        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
        printRequestAttributeSet.add(Sides.ONE_SIDED);
    }
View Full Code Here


    }
       
    public void print(Doc doc, String jobName) throws PrintException {
        // we need create a new job for each print
        DocPrintJob job = getPrintService().createPrintJob();
        PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet(printRequestAttributeSet);
        attrs.add(new JobName(jobName, Locale.getDefault()));
        job.print(doc, attrs);
    }
View Full Code Here

    public void doPrinting() {

        PrinterJob job = PrinterJob.getPrinterJob();

        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PageFormat pf = job.pageDialog( aset );

        job.setPrintable( this, pf );
        boolean ok = job.printDialog( aset );
View Full Code Here

            // set the Printable on the PrinterJob
            job.setPrintable(printable);

            // create an attribute set to store attributes from the print dialog
            PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();

            // set any attributes here
           
           
            // display a print dialog and record whether or not the user cancels it
View Full Code Here

    private DocFlavor assignDocFlavor() throws Exception {
        return config.getDocFlavor();     
    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
       
        return printRequestAttributeSet;
    }
View Full Code Here

        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        job = printService.createPrintJob();
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
        printRequestAttributeSet.add(Sides.ONE_SIDED);
    }
View Full Code Here

    private DocFlavor assignDocFlavor() throws Exception {
        return config.getDocFlavor();     
    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
        printRequestAttributeSet.add(config.getInternalOrientation());

        if (config.getMediaTray() != null) {
            MediaTray mediaTray = resolveMediaTray(config.getMediaTray());
       
            if (mediaTray == null) {
                throw new PrintException("mediatray not found " + config.getMediaTray());
            }
           
            printRequestAttributeSet.add(mediaTray);
        }
       
        return printRequestAttributeSet;
    }
View Full Code Here

    private void _restorePrinterAttr() {
        if (_printerAttr == null) {
            try {
                _printerAttr = (HashPrintRequestAttributeSet) Preferences.getPreferences().deserialize(_ATTR_FILE);
            } catch (Exception e) {
                _printerAttr = new HashPrintRequestAttributeSet();
            }
        }
    }
View Full Code Here

                ps = printservice;
            }

            if (ps != null)  {

                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                aset.add(OrientationRequested.PORTRAIT);
                aset.add(new JobName(AppLocal.APP_NAME + " - Document", null));
                aset.add(media);

                DocPrintJob printjob = ps.createPrintJob();
                Doc doc = new SimpleDoc(new PrintableBasicTicket(m_ticketcurrent, imageable_x, imageable_y, imageable_width, imageable_height), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);

                printjob.print(doc, aset);
View Full Code Here

    private void _restorePrinterAttr() {
        if (_printerAttr == null) {
            try {
                _printerAttr = (HashPrintRequestAttributeSet) Preferences.getPreferences().deserialize(_ATTR_FILE);
            } catch (Exception e) {
                _printerAttr = new HashPrintRequestAttributeSet();
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.print.attribute.HashPrintRequestAttributeSet

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.