Package javax.print

Examples of javax.print.DocPrintJob


        if (psvc == null) {
            throw new PrinterException("No print service found.");
        }

        DocPrintJob job = psvc.createPrintJob();
        Doc doc = new PageableDoc(getPageable());
        if (attributes == null) {
            attributes = new HashPrintRequestAttributeSet();
        }
        try {
            job.print(doc, attributes);
        } catch (PrintException e) {
            throw new PrinterException(e.toString());
        }
    }
View Full Code Here


            this.exceptionisnotnull = false;
        }

        public void run() {
            try {
                DocPrintJob spsDocPrintJob = streamservice.createPrintJob();
                spsDocPrintJob.print(printDoc, printAttributeSet);
            } catch (Exception e) {
                exception = e;
                exceptionisnotnull = true;
                try {
                    streamservice.getOutputStream().close();
View Full Code Here

        if (pService == null) {
            pService = PrintServiceLookup.lookupDefaultPrintService();
        }
       
        try {
            DocPrintJob job = pService.createPrintJob();
            job.print(doc, attrs);
        } catch (PrintException pe) {
            throw new PrinterException(pe.getMessage());
        }
    }
View Full Code Here

            this.exceptionisnotnull = false;
        }

        public void run() {
            try {
                DocPrintJob spsDocPrintJob = streamservice.createPrintJob();
                spsDocPrintJob.print(printDoc, printAttributeSet);
            } catch (Exception e) {
                exception = e;
                exceptionisnotnull = true;
                try {
                    streamservice.getOutputStream().close();
View Full Code Here

        if (pService == null) {
            pService = PrintServiceLookup.lookupDefaultPrintService();
        }
       
        try {
            DocPrintJob job = pService.createPrintJob();
            job.print(doc, attrs);
        } catch (PrintException pe) {
            throw new PrinterException(pe.getMessage());
        }
    }
View Full Code Here

      {
        getError().setValue(i18n.tr("Kein Drucker gefunden."));
        return;
      }

      DocPrintJob pj = service.createPrintJob();

      // BUGZILLA 24 http://www.willuhn.de/bugzilla/show_bug.cgi?id=24
      Doc doc = new SimpleDoc(iniletter.toString(),DOCFLAVOR,null);
      pj.print(doc,PRINTPROPS);
    }
    catch (Exception e)
    {
      Logger.error("error while printing ini letter",e);
      getError().setValue(i18n.tr("Fehler: {0}",e.getMessage()));
View Full Code Here

        boolean res2 = PrintServiceLookup.registerService(ps2);
        assertTrue("PrintService #2 should be registered.", res2);
        PrintService[] pss = PrintServiceLookup.lookupPrintServices(null, null);
        assertEquals("lookup should report two PrintServices.", numberOfPrintservicesBefore + 2, pss.length);

        DocPrintJob job1 = mock(DocPrintJob.class);
        when(ps1.createPrintJob()).thenReturn(job1);
       
        context.addRoutes(new RouteBuilder() {

            public void configure() {
View Full Code Here

        PrintService ps1 = mock(PrintService.class);
        when(ps1.getName()).thenReturn("MyPrinter\\\\remote\\printer1");
        when(ps1.isDocFlavorSupported(any(DocFlavor.class))).thenReturn(Boolean.TRUE);
        boolean res1 = PrintServiceLookup.registerService(ps1);
        assertTrue("The Remote PrintService #1 should be registered.", res1);
        DocPrintJob job1 = mock(DocPrintJob.class);
        when(ps1.createPrintJob()).thenReturn(job1);
       
        context.addRoutes(new RouteBuilder() {

            public void configure() {
View Full Code Here

        when(psDefault.getName()).thenReturn("DefaultPrinter");
        when(psDefault.isDocFlavorSupported(any(DocFlavor.class))).thenReturn(Boolean.TRUE);
        PrintServiceLookup psLookup = mock(PrintServiceLookup.class);
        when(psLookup.getPrintServices()).thenReturn(new PrintService[]{psDefault});
        when(psLookup.getDefaultPrintService()).thenReturn(psDefault);
        DocPrintJob docPrintJob = mock(DocPrintJob.class);
        when(psDefault.createPrintJob()).thenReturn(docPrintJob);
        MediaTray[] trays = new MediaTray[]{
            MediaTray.TOP,
            MediaTray.MIDDLE,
            MediaTray.BOTTOM
View Full Code Here

    Object payload = message.getPayload();

    final Doc doc = new SimpleDoc(message.getPayload(), docFlavor, das);

    final DocPrintJob job = this.printServiceExecutor.getPrintService().createPrintJob();

    PrintJobMonitor printJobMonitor = new PrintJobMonitor(job);

    job.print(doc, this.printRequestAttributeSet);

    printJobMonitor.waitForDone();

    if (payload instanceof InputStream) {
      ((InputStream) payload).close();
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.