< prev index next >

src/java.desktop/share/classes/java/awt/print/PrinterJob.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.print;
  27 
  28 import java.awt.AWTError;
  29 import java.awt.HeadlessException;
  30 import java.util.Enumeration;
  31 
  32 import javax.print.DocFlavor;
  33 import javax.print.PrintService;
  34 import javax.print.PrintServiceLookup;
  35 import javax.print.StreamPrintServiceFactory;

  36 import javax.print.attribute.PrintRequestAttributeSet;
  37 import javax.print.attribute.standard.Media;
  38 import javax.print.attribute.standard.MediaPrintableArea;
  39 import javax.print.attribute.standard.MediaSize;
  40 import javax.print.attribute.standard.MediaSizeName;
  41 import javax.print.attribute.standard.OrientationRequested;
  42 
  43 import sun.security.action.GetPropertyAction;
  44 
  45 /**
  46  * The {@code PrinterJob} class is the principal class that controls
  47  * printing. An application calls methods in this class to set up a job,
  48  * optionally to invoke a print dialog with the user, and then to print
  49  * the pages of the job.
  50  */
  51 public abstract class PrinterJob {
  52 
  53  /* Public Class Methods */
  54 
  55     /**
  56      * Creates and returns a {@code PrinterJob} which is initially
  57      * associated with the default printer.
  58      * If no printers are available on the system, a PrinterJob will still
  59      * be returned from this method, but {@code getPrintService()}
  60      * will return {@code null}, and calling
  61      * {@link #print() print} with this {@code PrinterJob} might
  62      * generate an exception.  Applications that need to determine if
  63      * there are suitable printers before creating a {@code PrinterJob}
  64      * should ensure that the array returned from


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.print;
  27 
  28 import java.awt.AWTError;
  29 import java.awt.HeadlessException;

  30 
  31 import javax.print.DocFlavor;
  32 import javax.print.PrintService;
  33 import javax.print.PrintServiceLookup;
  34 import javax.print.StreamPrintServiceFactory;
  35 import javax.print.attribute.AttributeSet;
  36 import javax.print.attribute.PrintRequestAttributeSet;
  37 import javax.print.attribute.standard.Media;
  38 import javax.print.attribute.standard.MediaPrintableArea;
  39 import javax.print.attribute.standard.MediaSize;
  40 import javax.print.attribute.standard.MediaSizeName;
  41 import javax.print.attribute.standard.OrientationRequested;
  42 


  43 /**
  44  * The {@code PrinterJob} class is the principal class that controls
  45  * printing. An application calls methods in this class to set up a job,
  46  * optionally to invoke a print dialog with the user, and then to print
  47  * the pages of the job.
  48  */
  49 public abstract class PrinterJob {
  50 
  51  /* Public Class Methods */
  52 
  53     /**
  54      * Creates and returns a {@code PrinterJob} which is initially
  55      * associated with the default printer.
  56      * If no printers are available on the system, a PrinterJob will still
  57      * be returned from this method, but {@code getPrintService()}
  58      * will return {@code null}, and calling
  59      * {@link #print() print} with this {@code PrinterJob} might
  60      * generate an exception.  Applications that need to determine if
  61      * there are suitable printers before creating a {@code PrinterJob}
  62      * should ensure that the array returned from


< prev index next >