/* * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * Provides the principal classes and interfaces for the Java™ Print * Service API. The Java Print Service API enables client and server * applications to: *
* The JDK includes {@code PrintServiceLookup} implementations that can locate * the standard platform printers. To locate other types of printers, such as * IPP printers or JINI printers, a print-service provider can write * implementations of {@code PrintServiceLookup}. The print-service provider can * dynamically install these {@code PrintServiceLookup} implementations using * the {@link java.util.ServiceLoader} facility. * *
* The {@code javax.print.attribute} package describes the types of attributes * and how they can be collected into sets. The * {@code javax.print.attribute.standard} package enumerates all of the standard * attributes supported by the API, most of which are implementations of * attributes specified in the IETF Specification, * RFC 2911 Internet Printing * Protocol, 1.1: Model and Semantics, dated September 2000. The attributes * specified in {@code javax.print.attribute.standard} include common * capabilities, such as: resolution, copies, media sizes, job priority, and * page ranges. * *
**{@code * FileInputStream psStream; * try { * psStream = new FileInputStream("file.ps"); * } catch (FileNotFoundException ffne) { * } * if (psStream == null) { * return; * } * DocFlavor psInFormat = DocFlavor.INPUT_STREAM.POSTSCRIPT; * Doc myDoc = new SimpleDoc(psStream, psInFormat, null); * PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); * aset.add(new Copies(5)); * aset.add(MediaSizeName.ISO_A4); * aset.add(Sides.DUPLEX); * PrintService[] services = * PrintServiceLookup.lookupPrintServices(psInFormat, aset); * if (services.length > 0) { * DocPrintJob job = services[0].createPrintJob(); * try { * job.print(myDoc, aset); * } catch (PrintException pe) {} * } * }*
* Please note: In the javax.print APIs, a null reference parameter to methods * is incorrect unless explicitly documented on the method as having a * meaningful interpretation. Usage to the contrary is incorrect coding and may * result in a run time exception either immediately or at some later time. * IllegalArgumentException and NullPointerException are examples of typical and * acceptable run time exceptions for such cases. * * @since 1.4 */ package javax.print;