Package java.awt.print

Examples of java.awt.print.PrinterException


        print(printJob, true);
    }

    private void print(PrinterJob job, boolean silent) throws PrinterException {
        if (job == null) {
            throw new PrinterException("The given printer job is null.");
        } else {
            job.setPageable(new PDPageable(this, job));
            if (silent || job.printDialog()) {
                job.print();
            }
View Full Code Here


     */
    public void print(PrinterJob printJob) throws PrinterException
    {
        if(printJob == null)
        {
            throw new PrinterException( "The delivered printJob is null." );
        }
        AccessPermission currentPermissions = this.getCurrentAccessPermission();

        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );
        }
        printJob.setPageable(this);
        if( printJob.printDialog() )
        {
            printJob.print();
View Full Code Here

     */
    public void silentPrint( PrinterJob printJob ) throws PrinterException
    {
        if(printJob == null)
        {
            throw new PrinterException( "The delivered printJob is null." );
        }
        AccessPermission currentPermissions = this.getCurrentAccessPermission();

        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );
        }
        printJob.setPageable(this);
        printJob.print();
    }
View Full Code Here

        final Page aPage = this.pageList.get(pageIndex);
        try {
            renderPage(aPage);
        } catch (final GalleyVisitorException e) {
            throw new PrinterException(e.getMessage());
        }
        this.graphics = oldGraphics;

        return PAGE_EXISTS;
    }
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 {
                job.endDoc();
            }
            stream.flush();
View Full Code Here

     */
    public void setPrintService(PrintService service)
        throws PrinterException {

        if (service == null) {
            throw new PrinterException("Service cannot be null");
        } else if (service.isDocFlavorSupported(
                                DocFlavor.SERVICE_FORMATTED.PAGEABLE) &&
            service.isDocFlavorSupported(
                                DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
           myService = service;
        } else {
            throw new PrinterException("Not a 2D print service: " + service);
        }
    }
View Full Code Here

           AttributeSet unsupported =
               service.getUnsupportedAttributes(
                                         DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                         attributes);
           if (unsupported != null) {
               throw new PrinterException("Fidelity cannot be satisfied");
           }
        }

        /*
         * Since we have verified supported values if fidelity is true,
View Full Code Here

            attributes = new HashPrintRequestAttributeSet();
        }
        try {
            job.print(doc, attributes);
        } catch (PrintException e) {
            throw new PrinterException(e.toString());
        }
    }
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.