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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, 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


 529      * <code>PageFormat</code> object.
 530      * <p>
 531      * If a supported attribute-value is specified in this attribute set,
 532      * it will take precedence over the API settings for this print()
 533      * operation only.
 534      * The following behaviour is specified for PageFormat:
 535      * If a client uses the Printable interface, then the
 536      * <code>attributes</code> parameter to this method is examined
 537      * for attributes which specify media (by size), orientation, and
 538      * imageable area, and those are used to construct a new PageFormat
 539      * which is passed to the Printable object's print() method.
 540      * See {@link Printable} for an explanation of the required
 541      * behaviour of a Printable to ensure optimal printing via PrinterJob.
 542      * For clients of the Pageable interface, the PageFormat will always
 543      * be as supplied by that interface, on a per page basis.
 544      * <p>
 545      * These behaviours allow an application to directly pass the
 546      * user settings returned from
 547      * <code>printDialog(PrintRequestAttributeSet attributes</code> to
 548      * this print() method.
 549      * <p>
 550      *
 551      * @param attributes a set of attributes for the job
 552      * @exception PrinterException an error in the print system
 553      *            caused the job to be aborted.
 554      * @see Book
 555      * @see Pageable
 556      * @see Printable
 557      * @since 1.4
 558      */
 559     public void print(PrintRequestAttributeSet attributes)
 560         throws PrinterException {
 561         print();
 562     }
 563 
 564     /**
 565      * Sets the number of copies to be printed.
 566      * @param copies the number of copies to be printed
 567      * @see #getCopies
 568      */
 569     public abstract void setCopies(int copies);


   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


 529      * <code>PageFormat</code> object.
 530      * <p>
 531      * If a supported attribute-value is specified in this attribute set,
 532      * it will take precedence over the API settings for this print()
 533      * operation only.
 534      * The following behaviour is specified for PageFormat:
 535      * If a client uses the Printable interface, then the
 536      * <code>attributes</code> parameter to this method is examined
 537      * for attributes which specify media (by size), orientation, and
 538      * imageable area, and those are used to construct a new PageFormat
 539      * which is passed to the Printable object's print() method.
 540      * See {@link Printable} for an explanation of the required
 541      * behaviour of a Printable to ensure optimal printing via PrinterJob.
 542      * For clients of the Pageable interface, the PageFormat will always
 543      * be as supplied by that interface, on a per page basis.
 544      * <p>
 545      * These behaviours allow an application to directly pass the
 546      * user settings returned from
 547      * <code>printDialog(PrintRequestAttributeSet attributes</code> to
 548      * this print() method.

 549      *
 550      * @param attributes a set of attributes for the job
 551      * @exception PrinterException an error in the print system
 552      *            caused the job to be aborted.
 553      * @see Book
 554      * @see Pageable
 555      * @see Printable
 556      * @since 1.4
 557      */
 558     public void print(PrintRequestAttributeSet attributes)
 559         throws PrinterException {
 560         print();
 561     }
 562 
 563     /**
 564      * Sets the number of copies to be printed.
 565      * @param copies the number of copies to be printed
 566      * @see #getCopies
 567      */
 568     public abstract void setCopies(int copies);