Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.JobName


                                public Object run() {
                                    return System.getProperty("user.name");
                                }
                            }), Locale.US) };
        } else if (JobName.class.isAssignableFrom(category)) {
            return new Object[] { new JobName("Java print job", Locale.US) };
        } else if (DocumentName.class.isAssignableFrom(category)) {
            return new Object[] { new DocumentName("Java print document",
                    Locale.US) };
        }
        return null;
View Full Code Here


                }
            }
        } else if (RequestingUserName.class.isAssignableFrom(category)) {
            return new Object[] { new RequestingUserName("I.A.Muser", Locale.US) };
        } else if (JobName.class.isAssignableFrom(category)) {
            return new Object[] { new JobName("Foo print job", Locale.US) };
        } else if (DocumentName.class.isAssignableFrom(category)) {
            return new Object[] { new DocumentName("Foo document", Locale.US) };
        }
        return null;
    }
View Full Code Here

                    "SERVICE_FORMATTED doc flavors.");
        }
    }

    public void setJobName(String jobName) {
        attrs.add(new JobName(jobName, Locale.getDefault()));
    }
View Full Code Here

        return c != null ? c.getValue() : 1;
    }

    @Override
    public String getJobName() {
        final JobName name = (JobName) attributes.get(JobName.class);
        return name != null ? name.getValue() : null;
    }
View Full Code Here

        attributes.add(new Copies(copies));
    }

    @Override
    public void setJobName(final String jobName) {
        attributes.add(new JobName(jobName, null));
    }
View Full Code Here

        }

        /* if no job name supplied use doc name (if supplied), if none and
         * its a URL use that, else finally anything .. */
        if (jobAttrSet.get(JobName.class) == null) {
            JobName jobName;
            if (docSet != null && docSet.get(DocumentName.class) != null) {
                DocumentName docName =
                    (DocumentName)docSet.get(DocumentName.class);
                jobName = new JobName(docName.getValue(), docName.getLocale());
                jobAttrSet.add(jobName);
            } else {
                String str = "JPS Job:" + doc;
                try {
                    Object printData = doc.getPrintData();
                    if (printData instanceof URL) {
                        str = ((URL)(doc.getPrintData())).toString();
                    }
                } catch (IOException e) {
                }
                jobName = new JobName(str, null);
                jobAttrSet.add(jobName);
            }
        }

        jobAttrSet = AttributeSetUtilities.unmodifiableView(jobAttrSet);
View Full Code Here

        if (attributes == null) {
            attributes = new HashPrintRequestAttributeSet();
        }
        attributes.add(new Copies(getCopies()));
        attributes.add(new JobName(getJobName(), null));

        boolean doPrint = false;
        DialogTypeSelection dts =
            (DialogTypeSelection)attributes.get(DialogTypeSelection.class);
        if (dts == DialogTypeSelection.NATIVE) {
            // Remove DialogTypeSelection.NATIVE to prevent infinite loop in
            // RasterPrinterJob.
            attributes.remove(DialogTypeSelection.class);
            doPrint = printDialog(attributes);
            // restore attribute
            attributes.add(DialogTypeSelection.NATIVE);
        } else {
            doPrint = printDialog(attributes);
        }

        if (doPrint) {
            JobName jobName = (JobName)attributes.get(JobName.class);
            if (jobName != null) {
                setJobName(jobName.getValue());
            }
            Copies copies = (Copies)attributes.get(Copies.class);
            if (copies != null) {
                setCopies(copies.getValue());
            }
View Full Code Here

                DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;

                PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
                attrs.add(OrientationRequested.PORTRAIT);
                attrs.add(PrintQuality.HIGH);
                attrs.add(new JobName(file.getName() + ".rio", null));

                PrintService service = PrintServiceLookup.lookupDefaultPrintService();

                // maybe we want to show the printer choice dialog
View Full Code Here

            Reader rdr;

            try {
                flavor = DocFlavor.URL.PDF;//TEXT_HTML_HOST;
                if (serv.isDocFlavorSupported(flavor)) {
                    aset.add(new JobName(flavor.toString(), Locale.US));
                    dset.add(new DocumentName(http_ps, Locale.US));
                    job = serv.createPrintJob();
                    url = new URL(http_ps);
                    doc = new SimpleDoc(url, flavor, dset);
                    System.out.println("\nPrinting on "
                            + job.getPrintService().getName() + "...");
                    job.print(doc, aset);
                    System.out.println("File '" + http_ps + "' was printed as "
                            + flavor.getRepresentationClassName());
                }

                flavor = DocFlavor.URL.GIF;
                if (serv.isDocFlavorSupported(flavor)) {
                    aset.add(new JobName(flavor.toString(), Locale.US));
                    dset.add(new DocumentName(http_gif, Locale.US));
                    job = serv.createPrintJob();
                    url = new URL(http_gif);
                    doc = new SimpleDoc(url, flavor, dset);
                    System.out.println("\nPrinting on "
                            + job.getPrintService().getName() + "...");
                    job.print(doc, aset);
                    System.out.println("File '" + http_gif + "' was printed as "
                            + flavor.getRepresentationClassName());
                }
            } catch (PrintException e1) {
                e1.printStackTrace();
            }

            flavor = DocFlavor.READER.TEXT_PLAIN;
            if (serv.isDocFlavorSupported(flavor)) {
                aset.add(new JobName(flavor.toString(), Locale.US));
                dset.add(new DocumentName(file_txt, Locale.US));
                job = serv.createPrintJob();
                rdr = new InputStreamReader(getClass().getResourceAsStream(
                        file_txt));
                doc = new SimpleDoc(rdr, flavor, dset);
                System.out.println("Printing on "
                        + job.getPrintService().getName() + "...");
                job.print(doc, aset);
                System.out.println("File '" + file_txt + "' was printed as "
                        + flavor.getRepresentationClassName());
            }

            flavor = DocFlavor.INPUT_STREAM.GIF;
            if (serv.isDocFlavorSupported(flavor)) {
                aset.add(new JobName(flavor.toString(), Locale.US));
                dset.add(new DocumentName(file_gif, Locale.US));
                job = serv.createPrintJob();
                stream = getClass().getResourceAsStream(file_gif);
                doc = new SimpleDoc(stream, flavor, dset);
                System.out.println("\nPrinting on "
                        + job.getPrintService().getName() + "...");
                job.print(doc, aset);
                System.out.println("File '" + file_gif + "' was printed as "
                        + flavor.getRepresentationClassName());
            }

            flavor = DocFlavor.BYTE_ARRAY.JPEG;
            if (serv.isDocFlavorSupported(flavor)) {
                aset.add(new JobName(flavor.toString(), Locale.US));
                dset.add(new DocumentName(file_gif, Locale.US));
                job = serv.createPrintJob();
                stream = getClass().getResourceAsStream(file_gif);
                byte[] gif_buf;
                byte[] buf = new byte[1024];
View Full Code Here

                    MediaSizeName.ISO_A3,
                    new Destination(uri1),
                    new Destination(uri2),
                    new Destination(uri3),
                    new DocumentName("xyz", Locale.US),
                    new JobName("xyz", Locale.US),
                    new RequestingUserName("xyz", Locale.US),
                    Sides.DUPLEX,
                    Sides.ONE_SIDED,
                    Sides.TUMBLE,
                    Sides.TWO_SIDED_LONG_EDGE,
View Full Code Here

TOP

Related Classes of javax.print.attribute.standard.JobName

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.