Package dori.jasper.engine.export

Examples of dori.jasper.engine.export.JRPrintServiceExporter


    // Linux: print queues like "draft", "normal", "photo", etc
    // Windows: use physical printername like  "Epson Stylus COLOR 680" or "HP LaserJet 5000 Series PCL"
    PrinterName printerName = new PrinterName("normal", Locale.getDefault());
    printServiceAttributeSet.add(printerName);

    JRPrintServiceExporter exporter = new JRPrintServiceExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(
      JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET,
      printRequestAttributeSet);
    exporter.setParameter(
      JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,
      printServiceAttributeSet);
    exporter.setParameter(
      JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG,
      Boolean.FALSE);
    exporter.setParameter(
      JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG,
      Boolean.TRUE);
   
    boolean preview = true;

    try {
      if (preview) {
        // preview is started in non_modal
        JasperViewer.viewReport(jasperPrint, false);
      } else {
        exporter.exportReport();
      }
    } catch (JRException je) {
      System.out.println(
        "Error printing report:\n" + je.getMessage());
    }
View Full Code Here


      } else {
        PrinterName printerName = new PrinterName(printerNameTemp, Locale.getDefault());
        printServiceAttributeSet.add(printerName);
      }

      JRPrintServiceExporter exporter = new JRPrintServiceExporter();
      exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
      exporter.setParameter(
        JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET,
        printRequestAttributeSet);
      exporter.setParameter(
        JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,
        printServiceAttributeSet);
      exporter.setParameter(
        JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG,
        Boolean.FALSE);
      exporter.setParameter(
        JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG,
        Boolean.TRUE);

      if (printPreview) {
        // preview is started in non_modal
        JasperViewer.viewReport(jasperPrint, false);
      } else {
        exporter.exportReport();
      }
    } catch (JRException je) {
      msg = "\nError printing card report:\nPlease check printer parameter.\n" + je.getMessage();
      log.warning(msg);
      throw new ControllerException(msg);
View Full Code Here

        PrinterName printerName =
          new PrinterName(printerNameTemp, Locale.getDefault());
        printServiceAttributeSet.add(printerName);
      }

      JRPrintServiceExporter exporter = new JRPrintServiceExporter();
      exporter.setParameter(
        JRExporterParameter.JASPER_PRINT,
        jasperPrint);
      exporter.setParameter(
        JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET,
        printRequestAttributeSet);
      exporter.setParameter(
        JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,
        printServiceAttributeSet);
      exporter.setParameter(
        JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG,
        Boolean.FALSE);
      exporter.setParameter(
        JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG,
        Boolean.TRUE);

      if (printPreview) {
        // preview is started in non_modal
        JasperViewer.viewReport(jasperPrint, false);
      } else {
        exporter.exportReport();
      }
    } catch (JRException je) {
      msg =
        "\nError printing envelop:\nPlease check printer parameter.\n"
          + je.getMessage();
View Full Code Here

TOP

Related Classes of dori.jasper.engine.export.JRPrintServiceExporter

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.