Spec-Zone .ru
спецификации, руководства, описания, API
CONTENTS | PREV | NEXT JavaTM Print Service API User Guide


How to Specify Attributes

Whether you are printing or streaming data, you specify attributes in the same way. You will usually use PrintRequestAttribute more often than the other kinds of attributes because print request attributes specify the settings for an entire print job. Bec ause you will most likely want to specify more than one attribute for a particular job, you need to create an attribute set. This sample demonstrates creating a PrintRequestAttributeSet that instructs the service to use A4 media to print five copies of th e job using both sides of the paper:

PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new Copies(5)); 
aset.add(MediaSize.ISO_A4); 
aset.add(Sides.DUPLEX); 
After creating an attribute set, you will pass it to the print job's print method, along with the DocFlavor. The Specifying Document Types discusses using DocFlavor. The Printing and Streaming Documents chapter discusses how to print. The next section explains some of the more commonly-used attributes in more detail.



CONTENTS | PREV | NEXT
Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved.