Package java.awt.print

Examples of java.awt.print.PrinterException


                    DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        } else if (psDocument != null) {
            doc = new SimpleDoc(psDocument,
                    DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        } else {
            throw new PrinterException("Neither Printable nor Pageable were " +
                    "specified.");
        }
       
        PrintService pService = service;
        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


                DocFlavor.SERVICE_FORMATTED.PRINTABLE) &&
            printservice.isDocFlavorSupported(
                DocFlavor.SERVICE_FORMATTED.PAGEABLE)) {
            service = printservice;
        } else {
            throw new PrinterException("PrintService doesn't support " +
                    "SERVICE_FORMATTED doc flavors.");
        }
    }
View Full Code Here

                    page = psDocument.getPrintable(iPage);
                    pageFormat = psDocument.getPageFormat(iPage);
                    if (page != null) {
                        result = page.print(fake, pageFormat, iPage);
                    } else {
                        throw new PrinterException("No printable for page " +
                                iPage + " in given document.");
                    }
                }
                if (result == Printable.PAGE_EXISTS) {
                    converter.startPage(iPage + 1);
View Full Code Here

                    page = psDocument.getPrintable(iPage);
                    pageFormat = psDocument.getPageFormat(iPage);
                    if (page != null) {
                        result = page.print(fake, pageFormat, iPage);
                    } else {
                        throw new PrinterException("No printable for page " +
                                iPage + " in given document.");
                    }
                }
                if (result == Printable.PAGE_EXISTS) {
                    converter.startPage(iPage + 1);
View Full Code Here

                    DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        } else if (psDocument != null) {
            doc = new SimpleDoc(psDocument,
                    DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        } else {
            throw new PrinterException("Neither Printable nor Pageable were " +
                    "specified.");
        }
       
        PrintService pService = service;
        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

                DocFlavor.SERVICE_FORMATTED.PRINTABLE) &&
            printservice.isDocFlavorSupported(
                DocFlavor.SERVICE_FORMATTED.PAGEABLE)) {
            service = printservice;
        } else {
            throw new PrinterException("PrintService doesn't support " +
                    "SERVICE_FORMATTED doc flavors.");
        }
    }
View Full Code Here

        if (epsPrinter == null) {
            if (getPrintService() instanceof PSStreamPrintService) {
                StreamPrintService sps = (StreamPrintService)getPrintService();
                mDestType = RasterPrinterJob.STREAM;
                if (sps.isDisposed()) {
                    throw new PrinterException("service is disposed");
                }
                output = sps.getOutputStream();
                if (output == null) {
                    throw new PrinterException("Null output stream");
                }
            } else {
                /* REMIND: This needs to be more maintainable */
                mNoJobSheet = super.noJobSheet;
                if (super.destinationAttr != null) {
View Full Code Here

            try {
                /**
                 * Spool to the printer.
                 */
                if (spoolFile == null || !spoolFile.exists()) {
                   pex = new PrinterException("No spool file");
                   return null;
                }
                String fileName = spoolFile.getAbsolutePath();
                String execCmd[] = printExecCmd(mDestination, mOptions,
                               mNoJobSheet, getJobNameInt(),
                                                1, fileName);

                Process process = Runtime.getRuntime().exec(execCmd);
                process.waitFor();
                spoolFile.delete();

            } catch (IOException ex) {
                pex = new PrinterIOException(ex);
            } catch (InterruptedException ie) {
                pex = new PrinterException(ie.toString());
            }
            return null;
        }
View Full Code Here

                job.printPage(this, 0);
            } catch (Throwable t) {
                if (t instanceof PrinterException) {
                    throw (PrinterException)t;
                } else {
                    throw new PrinterException(t.toString());
                }
            } finally {
                stream.println("cleartomark"); // restore stack state
                stream.println("pluginSave restore");
                job.endDoc();
View Full Code Here

            throws IllegalArgumentException, PrinterException {
        if (document == null || job == null) {
            throw new IllegalArgumentException(
                    "PDPageable(" + document + ", " + job + ")");
        } else if (!document.getCurrentAccessPermission().canPrint()) {
            throw new PrinterException(
                "You do not have permission to print this document");
        } else {
            document.getDocumentCatalog().getPages().getAllKids(pages);
            this.job = job;
        }
View Full Code Here

TOP

Related Classes of java.awt.print.PrinterException

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.