Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.Copies


        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        HashDocAttributeSet daset = new HashDocAttributeSet();
        DocPrintJob pj;
        Doc doc;

        aset.add(new Copies(2));
        aset.add(MediaSizeName.ISO_A4);
        daset.add(MediaName.ISO_A4_WHITE);
        daset.add(Sides.TWO_SIDED_LONG_EDGE);

        service = PrintServiceLookup.lookupDefaultPrintService();
View Full Code Here


    }   

    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());
View Full Code Here

            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

          exporter = new JRPrintServiceExporter();
          exporter.setExporterInput(new SimpleExporterInput(jasperPrint));

          PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
          printRequestAttributeSet.add(new Copies(mod.getPrintCopies()));


          PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
          printServiceAttributeSet.add(new PrinterName(JPrint.getPrinterServicebyName(printQueue).getName(), Locale.getDefault()));
View Full Code Here

          serviceAttributeSet.add(new PrinterName(JPrint.getPrinterShortName(JPrint.getPreferredPrinterQueueName()), null));
          exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, serviceAttributeSet);
          exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
          exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, mod.isPrintDialog());
          PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
          printRequestAttributeSet.add(new Copies(mod.getPrintCopies()));
          exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, printRequestAttributeSet);
          exporter.exportReport();
         
          /* Alternative method
            exporter = new JRPrintServiceExporter();
View Full Code Here

   
    //  Paper Attributes:   media-printable-area, orientation-requested, media
    PrintRequestAttributeSet prats = m_layout.getPaper().getPrintRequestAttributeSet();
    //  add:        copies, job-name, priority
    if (m_info.isDocumentCopy() || m_info.getCopies() < 1)
      prats.add (new Copies(1));
    else
      prats.add (new Copies(m_info.getCopies()));
    Locale locale = Language.getLoginLanguage().getLocale();
    prats.add(new JobName(m_printFormat.getName(), locale));
    prats.add(PrintUtil.getJobPriority(m_layout.getNumberOfPages(), m_info.getCopies(), true));

    try
    {
      //  PrinterJob
      PrinterJob job = getPrinterJob(m_info.getPrinterName());
    //  job.getPrintService().addPrintServiceAttributeListener(this);
      job.setPageable(m_layout.getPageable(false))//  no copy
    //  Dialog
      try
      {
        if (m_info.isWithDialog() && !job.printDialog(prats))
          return;
      }
      catch (Exception e)
      {
        log.log(Level.WARNING, "Operating System Print Issue, check & try again", e);
        return;
      }

    //  submit
      boolean printCopy = m_info.isDocumentCopy() && m_info.getCopies() > 1;
      ArchiveEngine.get().archive(m_layout, m_info);
      PrintUtil.print(job, prats, false, printCopy);

      //  Document: Print Copies
      if (printCopy)
      {
        log.info("Copy " + (m_info.getCopies()-1));
        prats.add(new Copies(m_info.getCopies()-1));
        job = getPrinterJob(m_info.getPrinterName());
      //  job.getPrintService().addPrintServiceAttributeListener(this);
        job.setPageable (m_layout.getPageable(true));    //  Copy
        PrintUtil.print(job, prats, false, false);
      }
View Full Code Here

      DocAttributeSet das = new HashDocAttributeSet();

      try
      {
        PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
        pras.add(new Copies(1));

        FileInputStream fis = new FileInputStream(filename);
        v_doc = new SimpleDoc(fis, v_flavor, das);
        v_job.print(v_doc, pras);
        logger.debug("Submitting file to spooler : " + filename);
View Full Code Here

    }   

    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());
View Full Code Here

    }   

    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());
View Full Code Here

        return proceedWithPrint;
    }

    private void updateAttributes() {
        Copies c = (Copies)attributes.get(Copies.class);
        jobAttributes.setCopies(c.getValue());

        SunPageSelection sel =
            (SunPageSelection)attributes.get(SunPageSelection.class);
        if (sel == SunPageSelection.RANGE) {
            jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
View Full Code Here

TOP

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

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.