Package javax.print.attribute

Examples of javax.print.attribute.PrintRequestAttributeSet


    DocAttributeSet docAttribs   = new HashDocAttributeSet();
    javax.print.Doc doc = new javax.print.SimpleDoc(is, flavor, docAttribs);
   
    try
    {
      PrintRequestAttributeSet printAttributes = new HashPrintRequestAttributeSet();
      job.print(doc, printAttributes);
    }
    catch (PrintException e)
    {
      throw new RuntimeException("print: fail to print the data. Error: " + e.getMessage());
View Full Code Here


            job.setPrintService(service);
        }

        job.setPrintable(printable);

        final PrintRequestAttributeSet attr = (attributes == null)
            ? new HashPrintRequestAttributeSet()
            : attributes;

        if (showPrintDialog && ! isHeadless && ! job.printDialog(attr)) {
            return false;
View Full Code Here

      dialog.setLocationRelativeTo(owner);
  }
        dialog.show();

        if (dialog.getStatus() == ServiceDialog.APPROVE) {
            PrintRequestAttributeSet newas = dialog.getAttributes();
            Class dstCategory = Destination.class;
            Class amCategory = SunAlternateMedia.class;
            Class fdCategory = Fidelity.class;

            if (attributes.containsKey(dstCategory) &&
                !newas.containsKey(dstCategory))
            {
                attributes.remove(dstCategory);
            }

            if (attributes.containsKey(amCategory) &&
                !newas.containsKey(amCategory))
            {
                attributes.remove(amCategory);
            }

            attributes.addAll(newas);
View Full Code Here

            job.setPrintService(service);
        }

        job.setPrintable(printable);

        final PrintRequestAttributeSet attr = (attributes == null)
            ? new HashPrintRequestAttributeSet()
            : attributes;       

        if (showPrintDialog && ! isHeadless && ! job.printDialog(attr)) {
            return false;
View Full Code Here

    private FopFactory fopFactory = FopFactory.newInstance();

    private DocPrintJob createDocPrintJob() {
        PrintService[] services = PrintServiceLookup.lookupPrintServices(
                DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
        PrintService printService = ServiceUI.printDialog(null, 50, 50,
                services, services[0], null, attributes);
        if (printService != null) {
            return printService.createPrintJob();
        } else {
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 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

     *  Printable or Pageable then those interfaces are used to print
     *  it.
     */
    protected void _print() {
        // Build a set of attributes
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PrinterJob job = PrinterJob.getPrinterJob();

        if (this instanceof Pageable) {
            job.setPageable((Pageable) this);
        } else if (this instanceof Printable) {
View Full Code Here

     *  behind other windows.  However, it does honor
     *  the user's choice of portrait vs. landscape
     */
    protected void _printCrossPlatform() {
        // Build a set of attributes
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(plot);

        if (job.printDialog(aset)) {
            try {
View Full Code Here

        public void actionPerformed(ActionEvent event) {
            if (event.getSource() == _fillButton) {
                fillPlot();
            } else if (event.getSource() == _printButton) {
                // FIXME:  Code duplication with PlotFrame._printCrossPlatform
                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                PrinterJob job = PrinterJob.getPrinterJob();

                // rbeyer@LPL.Arizona.EDU: Get the Page Format and use it.
                //PageFormat format = job.pageDialog(job.defaultPage());
                //job.setPrintable(PlotBox.this, format);
View Full Code Here

TOP

Related Classes of javax.print.attribute.PrintRequestAttributeSet

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.