Whys is'nt the code below printing
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kirti_Singh
Posted On:   Tuesday, April 16, 2002 12:51 AM

import java.io.*; import javax.print.*; import javax.print.attribute.*; import javax.print.attribute.standard.*; import javax.print.event.*; public class MyPrint { public static void main(String args[]) throws Exception{ FileInputStream fs=new FileInputStream(args[0]); DocFlavor myFormat = DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII; SimpleDoc sd=new SimpleDoc(fs, myFormat, null); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(MediaSize.ISO.A4); aset.add(new Copies(1)); PrintService[] services=PrintServiceLookup.lookupPrintServices(myFormat,aset); System.out.println(services.length); if(services.length > 0){    More>>

import java.io.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.event.*;
public class MyPrint {
public static void main(String args[]) throws Exception{
FileInputStream fs=new FileInputStream(args[0]);
DocFlavor myFormat = DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII;
SimpleDoc sd=new SimpleDoc(fs, myFormat, null);
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSize.ISO.A4);
aset.add(new Copies(1));
PrintService[] services=PrintServiceLookup.lookupPrintServices(myFormat,aset);
System.out.println(services.length);
if(services.length > 0){
DocPrintJob job = services[0].createPrintJob();
try{
job.print(sd,aset);
}catch (PrintException pe){System.out.println(pe);}
}
fs.close();

}
}

   <<Less

Re: Whys is'nt the code below printing

Posted By:   Mike_Friedrich  
Posted On:   Monday, April 22, 2002 02:16 AM

Please use code-tags (pre) from the Posting Guidelines and will try to help.
About | Sitemap | Contact