Example usage for javax.print.attribute HashPrintJobAttributeSet HashPrintJobAttributeSet

List of usage examples for javax.print.attribute HashPrintJobAttributeSet HashPrintJobAttributeSet

Introduction

In this page you can find the example usage for javax.print.attribute HashPrintJobAttributeSet HashPrintJobAttributeSet.

Prototype

public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) 

Source Link

Document

Construct a new attribute set, initially populated with the values from the given set where the members of the attribute set are restricted to the PrintJobAttribute interface.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    OutputStream fos = new BufferedOutputStream(new FileOutputStream("filename.ps"));
    DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
    StreamPrintServiceFactory[] factories = StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor,
            DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());

    StreamPrintService service = factories[0].getPrintService(fos);

    DocPrintJob job = service.createPrintJob();
    PrintJobAttributeSet set = new HashPrintJobAttributeSet(job.getAttributes());
    set.add(new JobMediaSheetsCompleted(0));
    job.addPrintJobAttributeListener(new MyPrintJobAttributeListener(), set);
}