Package javax.print

Examples of javax.print.DocPrintJob


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

    final PrintReportProcessor reportPane = new PrintReportProcessor(report);
    final DocPrintJob job = printService.createPrintJob();
    final SimpleDoc document = new SimpleDoc
        (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

    try
    {
      job.print(document, attributes);
    }
    finally
    {
      reportPane.close();
    }
View Full Code Here


    try
    {
      reportPane.fireProcessingStarted();

      final DocPrintJob job = service.createPrintJob();
      final SimpleDoc document = new SimpleDoc
          (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

      job.print(document, attributes);
    }
    finally
    {
      reportPane.fireProcessingFinished();
      reportPane.close();
View Full Code Here

            throw new NullPrintServiceException(err);
        } else if (rawCmds == null) {
            throw new NullCommandException(err);
        }
        SimpleDoc doc = new SimpleDoc(rawCmds.getBytes(), docFlavor, docAttr);
        DocPrintJob pj = ps.createPrintJob();
        pj.addPrintJobListener(new PrintJobListener() {
            public void printDataTransferCompleted(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
            public void printJobCompleted(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
            public void printJobFailed(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
            public void printJobCanceled(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
            public void printJobNoMoreEvents(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
            public void printJobRequiresAttention(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
           
        });
        
        JZebraTools.log("Sending print job to printer: \"" + ps.getName() + "\"");
        pj.print(doc, reqAttr);
        return true;
    }
View Full Code Here

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

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

              final DocPrintJob final_job = service.createPrintJob();

              final MessagePrinterDisplay mpd = new MessagePrinterDisplay(messagePrinter, final_job, final_source);

              final_job.addPrintJobListener(mpd);

              mpd.show();

              Runnable runMe = new Runnable() {
                  public void run() {
                    try {
                      final_job.print(myDoc, final_attributes);
                    } catch (PrintException pe) {
                      if (mpd.getStatus() != MessagePrinterDisplay.CANCELED)
                        mpd.showError("Failed to print", pe);
                    }
                  }
View Full Code Here

                for (Object pra : printRequestAttributes) {
                    Debug.logInfo("Adding PrintRequestAttribute: " + pra, module);
                    praset.add((PrintRequestAttribute) pra);
                }
            }
            DocPrintJob job = printer.createPrintJob();
            job.print(myDoc, praset);
        } catch (Exception e) {
            Debug.logError(e, "Error rendering [" + contentType + "]: " + e.toString(), module);
            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale));
        }
View Full Code Here

        }
    }
       
    public void print(Doc doc) throws PrintException {
        // we need create a new job for each print
        DocPrintJob job = getPrintService().createPrintJob();
        job.print(doc, printRequestAttributeSet);
    }
View Full Code Here

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

    final PrintReportProcessor reportPane = new PrintReportProcessor(report);
    final DocPrintJob job = printService.createPrintJob();
    final SimpleDoc document = new SimpleDoc
        (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

    try
    {
      job.print(document, attributes);
    }
    finally
    {
      reportPane.close();
    }
View Full Code Here

    try
    {
      reportPane.fireProcessingStarted();

      final DocPrintJob job = service.createPrintJob();
      final SimpleDoc document = new SimpleDoc
          (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

      job.print(document, attributes);
    }
    finally
    {
      reportPane.fireProcessingFinished();
      reportPane.close();
View Full Code Here

              comp.paint(g);
              return Printable.PAGE_EXISTS;
            }
          }
        }, flavor, null);
        DocPrintJob job = service.createPrintJob();
        PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
        job.print(doc, attributes);
        out.close();
      }
    } else {
      // parrt: works with [image/jpeg, image/png, image/x-png, image/vnd.wap.wbmp, image/bmp, image/gif]
      Rectangle rect = comp.getBounds();
View Full Code Here

        //aset.add(MediaSize.A4);
        aset.add(Sides.ONE_SIDED);

        PrintService[] services = PrintServiceLookup.lookupPrintServices(docFlavor, aset);
        if (services.length > 0) {
            DocPrintJob job = services[0].createPrintJob();
            try {
                job.print(myDoc, aset);
            } catch (PrintException pe) {
                String errMsg = "Unable to print PDF from XSL-FO: " + pe.toString();
                Debug.logError(pe, errMsg, module);
                return ServiceUtil.returnError(errMsg);
            }
View Full Code Here

TOP

Related Classes of javax.print.DocPrintJob

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.