KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jnlp > PrintService


1 /*
2  * @(#)PrintService.java 1.10 04/03/12
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.jnlp;
9
10 import java.awt.print.Pageable;
11 import java.awt.print.Printable;
12 import java.awt.print.PageFormat;
13
14 /**
15  * <code>PrintService</code> provides methods for access to printing
16  * functions, even for applications that are running in the untrusted
17  * execution environment. Using this service, an application can
18  * submit a print job to the JNLP client. The client can then display
19  * this request to the user, and if accepted, queue the request to the
20  * printer.
21  *
22  * @since 1.0
23  */

24
25 public interface PrintService {
26
27   /**
28    * Creates a new PageFormat instance and sets it to the default
29    * size and orientation.
30    *
31    * @return a <code>PageFormat</code> set to the default
32    * size and orientation.
33    */

34   public PageFormat getDefaultPage();
35
36   /**
37    * Displays a dialog that allows modification of a
38    * <code>PageFormat</code> instance. The <code>page</code>
39    * argument is used to initialize controls in the page setup dialog.
40    * If the user cancels the dialog then this method returns the
41    * original <code>page</code> object unmodified. If the user
42    * okays the dialog then this method returns a new
43    * <code>PageFormat</code> object with the indicated changes. In
44    * either case, the original <code>page</code> object is not
45    * modified.
46    *
47    * @param page the default <code>PageFormat</code> presented
48    * to the user for modification.
49    *
50    * @return the original <code>page</code> object if the
51    * dialog is cancelled; a new
52    * <code>PageFormat</code> object containing
53    * the format indicated by the user if the
54    * dialog is acknowledged.
55    */

56   public PageFormat showPageFormatDialog(PageFormat page);
57
58   /**
59    * Prints a document using the given <code>Pageable</code> object
60    *
61    * @param document the pages to be printed. It can not be null.
62    *
63    * @return <code>true</code> if printing was successfull,
64    * <code>false</code> otherwise.
65    */

66   public boolean print(Pageable document);
67
68   /**
69    * Prints a document using the given <code>Printable</code> object
70    *
71    * @param painter the <code>Printable</code> called to render
72    * each page of the document.
73    *
74    * @return <code>true</code> if printing was successfull,
75    * <code>false</code> otherwise.
76    */

77   public boolean print(Printable painter);
78
79 }
80
Popular Tags