Package javax.print

Examples of javax.print.PrintException


                    InputStream in = doc.getStreamForBytes();
                    FileOutputStream fos = new FileOutputStream(file);
                    IOHelper.copyAndCloseInput(in, fos);
                    IOHelper.close(fos);
                } catch (Exception e) {
                    throw new PrintException("Error writing Document to the target file " + file.getAbsolutePath());
                }   
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Issuing Job {} to Printer: {}", i, this.printService.getName());
                }
View Full Code Here


    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
       
        return printRequestAttributeSet;
View Full Code Here

        } else {
            PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
            setPrinter("\\\\" + config.getHostname() + "\\" + config.getPrintername());
            int position = findPrinter(services, printer);
            if (position < 0) {
                throw new PrintException("No printer found with name: " + printer + ". Please verify that the host and printer are registered and reachable from this machine.");
            }        
            printService = services[position];
        }
        return printService;
    }
View Full Code Here

    private Doc doc;

    public PrinterOperations() throws PrintException {       
        printService = PrintServiceLookup.lookupDefaultPrintService();
        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        job = printService.createPrintJob();
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
View Full Code Here

                    InputStream in = doc.getStreamForBytes();
                    FileOutputStream fos = new FileOutputStream(file);
                    IOHelper.copyAndCloseInput(in, fos);
                    IOHelper.close(fos);
                } catch (Exception e) {
                    throw new PrintException("Error writing Document to the target file " + file.getAbsolutePath());
                }   
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Issuing Job {} to Printer: {}", i, this.printService.getName());
                }
View Full Code Here

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
        printRequestAttributeSet.add(config.getInternalOrientation());

        if (config.getMediaTray() != null) {
            MediaTray mediaTray = resolveMediaTray(config.getMediaTray());
       
            if (mediaTray == null) {
                throw new PrintException("mediatray not found " + config.getMediaTray());
            }
           
            printRequestAttributeSet.add(mediaTray);
        }
       
View Full Code Here

            }
            log.debug("Using printer name: {}", name);
            setPrinter(name);
            int position = findPrinter(services, printer);
            if (position < 0) {
                throw new PrintException("No printer found with name: " + printer + ". Please verify that the host and printer are registered and reachable from this machine.");
            }        
            printService = services[position];
        }
        return printService;
    }
View Full Code Here

    private Doc doc;

    public PrinterOperations() throws PrintException {       
        printService = PrintServiceLookup.lookupDefaultPrintService();
        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
View Full Code Here

                    InputStream in = doc.getStreamForBytes();
                    FileOutputStream fos = new FileOutputStream(file);
                    IOHelper.copyAndCloseInput(in, fos);
                    IOHelper.close(fos);
                } catch (Exception e) {
                    throw new PrintException("Error writing Document to the target file " + file.getAbsolutePath());
                }   
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Issuing Job {} to Printer: {}", i, this.printService.getName());
                }
View Full Code Here

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
       
        return printRequestAttributeSet;
View Full Code Here

TOP

Related Classes of javax.print.PrintException

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.