CONTENTS | PREV | NEXT JavaTM Print Service API User Guide

StreamPrintService Versus PrintService

The JavaTM Print Service API includes a PrintService class and a StreamPrintService class. A StreamPrintService extends PrintService, and so a StreamPrintService can be used anywhere a PrintService can be used. However, PrintService and StreamPrintService are used for different purposes. APrintService is used to direct output to a printer; a StreamPrintService is used to export formatted print data to a stream, usually to a different format. When locating a StreamPrintService, you specify the required output format in the form of a MIME type argument and provide an OutputStream to receive the data. You do not provide a representation class when locating a StreamPrintService, as you do when locating a PrintService, because the output is always delivered to an OutputStream.

After locating a service, you obtain a print job and submit the print job to the service in the same way whether you are using a PrintService or a StreamPrintServie. The major differences between StreamPrintService and PrintService are in the way they are located. The next section discusses locating both print services and stream print services.

Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved.