Printing to a File - Java File Path IO

Java examples for File Path IO:Text File

Description

Printing to a File

Demo Code

import javax.print.PrintException;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Destination;

public class Main {
  public static void main(String[] argv) throws Exception {
    try {//w ww.j ava  2s .  co  m
      // Set up destination attribute
      PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
      aset.add(new Destination(new java.net.URI("file:e:/temp/out.ps")));
      
      // Print it
      //job.print(doc, aset);
    } catch (java.net.URISyntaxException e) {
    }
  }
}

Related Tutorials