Package javax.print.attribute

Examples of javax.print.attribute.PrintRequestAttributeSet


   * @return
   */
  public static int isValidConfiguration(final PrintRequestAttributeSet attributes,
                                         final MasterReport report)
  {
    final PrintRequestAttributeSet reportAttributes =
        copyConfiguration(null, report);
    // now, compare that minimal set with the given attribute collection.

    final Attribute[] printAttribs = reportAttributes.toArray();
    boolean invalidConfig = false;
    for (int i = 0; i < printAttribs.length; i++)
    {
      final Attribute attrib = printAttribs[i];
      if (attributes.containsValue(attrib) == false)
View Full Code Here


        throw new PrintException
            ("The print service implementation does not support the Pageable Flavor.");
      }
    }

    PrintRequestAttributeSet attributes =
        Java14PrintUtil.copyConfiguration(null, report);
    attributes = Java14PrintUtil.copyAuxillaryAttributes(attributes, report);

    final PrintReportProcessor reportPane = new PrintReportProcessor(report);
    final DocPrintJob job = printService.createPrintJob();
View Full Code Here

    if (services.length == 0)
    {
      throw new PrintException
          ("Unable to find a matching print service implementation.");
    }
    PrintRequestAttributeSet attributes =
        Java14PrintUtil.copyConfiguration(null, report);
    attributes = Java14PrintUtil.copyAuxillaryAttributes(attributes, report);

    final PrintService service = ServiceUI.printDialog
        (null, 50, 50, services, lookupPrintService(),
View Full Code Here

      catch (PrinterException e)
      {
        throw new JRException(e);
      }

      PrintRequestAttributeSet printRequestAttributeSet = null;
      if(displayPrintDialogOnlyOnce || displayPageDialogOnlyOnce)
      {
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        setDefaultPrintRequestAttributeSet(printRequestAttributeSet);
        setOrientation((JasperPrint)jasperPrintList.get(0), printRequestAttributeSet);
        if(displayPageDialogOnlyOnce)
        {
          if(printerJob.pageDialog(printRequestAttributeSet) == null)
          {
            return;
          }
          else
          {
            displayPageDialog = false;
          }
        }
        if(displayPrintDialogOnlyOnce)
        {
          if(!printerJob.printDialog(printRequestAttributeSet))
          {
            printStatus = new Boolean[]{Boolean.FALSE};
            return;
          }
          else
          {
            displayPrintDialog = false;
          }
        }
      }
     
      List status = new ArrayList();
      // fix for bug ID artf1455 from jasperforge.org bug database
      for(reportIndex = 0; reportIndex < jasperPrintList.size(); reportIndex++)
      {
        setJasperPrint((JasperPrint)jasperPrintList.get(reportIndex));

        exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.PROGRESS_MONITOR, parameters.get(JRExporterParameter.PROGRESS_MONITOR));
        exporter.setParameter(JRExporterParameter.OFFSET_X, parameters.get(JRExporterParameter.OFFSET_X));
        exporter.setParameter(JRExporterParameter.OFFSET_Y, parameters.get(JRExporterParameter.OFFSET_Y));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, parameters.get(JRGraphics2DExporterParameter.ZOOM_RATIO));
        exporter.setParameter(JRExporterParameter.CLASS_LOADER, classLoader);
        exporter.setParameter(JRExporterParameter.URL_HANDLER_FACTORY, urlHandlerFactory);
        exporter.setParameter(JRExporterParameter.FILE_RESOLVER, fileResolver);
        if (parameters.containsKey(JRExporterParameter.FILTER))
        {
          exporter.setParameter(JRExporterParameter.FILTER, filter);
        }
        exporter.setParameter(JRGraphics2DExporterParameter.MINIMIZE_PRINTER_JOB_SIZE, parameters.get(JRGraphics2DExporterParameter.MINIMIZE_PRINTER_JOB_SIZE));
       
        if(displayPrintDialog || displayPageDialog ||
            (!displayPrintDialogOnlyOnce && !displayPageDialogOnlyOnce))
        {
          printRequestAttributeSet = new HashPrintRequestAttributeSet();
          setDefaultPrintRequestAttributeSet(printRequestAttributeSet);
          setOrientation(jasperPrint, printRequestAttributeSet);
        }
   
        try
        {
         
          if (!isModeBatch)
          {
            printRequestAttributeSet.add(new PageRanges(startPageIndex + 1, endPageIndex + 1));
          }

          printerJob.setJobName("JasperReports - " + jasperPrint.getName());

          if (displayPageDialog)
View Full Code Here

   
  }
 
  private void setDefaultPrintRequestAttributeSet(PrintRequestAttributeSet printRequestAttributeSet)
  {
    PrintRequestAttributeSet printRequestAttributeSetParam =
      (PrintRequestAttributeSet)parameters.get(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET);
    if (printRequestAttributeSetParam != null)
    {
      printRequestAttributeSet.addAll(printRequestAttributeSetParam);
    }
View Full Code Here

      // Background this, as it takes a while.
      new Thread() {
        public void run() {
          try {
            PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
            pras.add(new JobName(entry.getCiteKey(), null));
            previewPane.print(null, null, true, null, pras, false);

          } catch (PrinterException e) {

            // Inform the user... we don't know what to do.
View Full Code Here

   *
   */
  public void print() throws JRException
  {
    long start = System.currentTimeMillis();
    PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
    printRequestAttributeSet.add(MediaSizeName.ISO_A4);

    PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
    //printServiceAttributeSet.add(new PrinterName("Epson Stylus 820 ESC/P 2", null));
    //printServiceAttributeSet.add(new PrinterName("hp LaserJet 1320 PCL 6", null));
    //printServiceAttributeSet.add(new PrinterName("PDFCreator", null));
View Full Code Here

        PrinterJob printJob = PrinterJob.getPrinterJob();

        printJob.setPrintable(new GanttPrintable(image,
                GanttPrintable.REDUCE_FACTOR_DEFAULT));

        PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
        attr.add(MediaSizeName.ISO_A4);
        attr.add(OrientationRequested.LANDSCAPE);

        if (printJob.printDialog(attr)) {
            try {
                printJob.print(attr);
            } catch (Exception e) {
View Full Code Here

    private void print() {
        PrinterJob prnJob = PrinterJob.getPrinterJob();
        prnJob.setPrintable(myPrintable);
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
        attr.add(myMediaSizeName);
        attr.add(myOrientation == PageFormat.LANDSCAPE ?
               OrientationRequested.LANDSCAPE :
                   OrientationRequested.PORTRAIT);
        Document doc = myProject.getDocument();
        if (doc != null)
            attr.add(new JobName(doc.getDescription(), language.getLocale()));

        if (prnJob.printDialog(attr)) {
            try {
                prnJob.print(attr);
                setVisible(false);
View Full Code Here

            final DocFlavor messageFormat = DocFlavor.SERVICE_FORMATTED.PRINTABLE;

            // bring up a dialog.
            PrintService[] services = PrintServiceLookup.lookupPrintServices(messageFormat, null);

            PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
            PrintService service =  ServiceUI.printDialog(null, 50, 50,
                                                          services,
                                                          PrintServiceLookup.lookupDefaultPrintService(),
                                                          messageFormat,
                                                          attributes);

            if (service != null) {
              final PrintRequestAttributeSet final_attributes = attributes;

              final Doc myDoc = new SimpleDoc(messagePrinter, messageFormat, null);

              final DocPrintJob final_job = service.createPrintJob();
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.