Java Code Examples for javax.print.PrintService#getAttributes()

The following examples show how to use javax.print.PrintService#getAttributes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 2
Source File: PSPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 3
Source File: PSPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 4
Source File: PSPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 5
Source File: PSPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 6
Source File: PSPrinterJob.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mPSStream.checkError()) {
            abortDoc();
            throw new PrinterException("Error while writing to file");
        }
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 7
Source File: PSPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mPSStream.checkError()) {
            abortDoc();
            throw new PrinterException("Error while writing to file");
        }
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 8
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 9
Source File: PSPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 10
Source File: PSPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 11
Source File: PSPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 12
Source File: PSPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 13
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}
 
Example 14
Source File: PSPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoked by the RasterPrintJob super class
 * this method is called after that last page
 * has been imaged.
 */
protected void endDoc() throws PrinterException {
    if (mPSStream != null) {
        mPSStream.println(EOF_COMMENT);
        mPSStream.flush();
        if (mDestType != RasterPrinterJob.STREAM) {
            mPSStream.close();
        }
    }
    if (mDestType == RasterPrinterJob.PRINTER) {
        PrintService pServ = getPrintService();
        if (pServ != null) {
            mDestination = pServ.getName();
           if (isMac) {
                PrintServiceAttributeSet psaSet = pServ.getAttributes();
                if (psaSet != null) {
                    mDestination = psaSet.get(PrinterName.class).toString() ;
                }
            }
        }
        PrinterSpooler spooler = new PrinterSpooler();
        java.security.AccessController.doPrivileged(spooler);
        if (spooler.pex != null) {
            throw spooler.pex;
        }
    }
}